BankInfo = { -- age in Years, Balance in thousands LOWERCASE k
[1] = {Name = "Tom", Age = 10, balance = "1k", credit = 1000,},
[2] = {Name = "Dylan", Age = 5, balance = "2.5k", credit = 800,},
[3] = {Name = "Bob", Age = 1, balance = "0.002k", credit = -50,},
}
function intro() -- only appears IF theres no initial input (mostly on the first run)
print("Who would you like to manage?")
for _,v in pairs(BankInfo) do
print(v.Name)
end
print("Everyone")
end
local choice = io.read("*line") -- reads the line
if choice == nil then
intro() -- does stated above 'intro' function
end
for _,v in pairs(BankInfo) do -- main for loop for this code
if choice == v.Name then -- for all people in the moduele
print(v.Name .. "'s Account")
s = v.balance
s = s:gsub('k', '')
print("$" .. math.floor(tonumber(s) * 1000))
print(v.credit .. " credit score")
elseif choice == "Everyone" then -- for everyone
print(v.Name .. "'s Account")
s = v.balance
s = s:gsub('k', '')
print("$" .. math.floor(tonumber(s) * 1000))
print(v.credit .. " credit score")
print("-----------") -- just a divider for visual appearance
end
end
To embed this project on your website, copy the following code and paste it into your website's HTML: