Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.stdout:setvbuf("no")
- local info = {}
- local money = 10000
- for n in love.filesystem.lines("inf.csv") do
- table.insert(info,n)
- end
- if not love.filesystem.isFile("yiv.csv") then
- love.filesystem.newFile("yiv.csv")
- else
- love.filesystem.write("yiv.csv","")
- end
- function love.draw(...)
- love.graphics.print("Currently writing to file...")
- end
- function love.load(...)
- for k,v in ipairs(info) do
- local yearsep = v:find("%,")
- local year = v:sub(1,yearsep-1)
- print(year)
- for nx in v:gmatch("[^%,]+") do --iterate over a ',' character
- info[k] = nx:match("%s*(.*)%s*") --get rid of whitespace
- end
- info[k] = {year,info[k]}
- if k > 1 then
- if tonumber(info[k][1]) == 1959 then
- money = 10000
- info[k][3] = 10000
- elseif tonumber(info[k][1]) > 1959 then
- money = money + (money*tonumber(info[k][2]))/100
- info[k][3] = money
- else
- info[k][3] = money - (money*tonumber(info[k][2]))/100
- end
- else
- info[k][3] = "10000 in 1959 is worth"
- end
- love.filesystem.append("yiv.csv",table.concat(info[k],",").."\n")
- end
- print(money)
- love.event.quit()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement