Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- simple data converter to be used once then deleted.
- local fileIn, fileOut = ...
- assert(fileIn, "Expected argument 1 filename.")
- assert(fileOut, "Expected argument 2 filename.")
- local a = io.open(fileIn, 'r')
- local data = a:read("*a")
- a:close()
- local new = {}
- local a = io.open(fileOut, 'w')
- print("ITEM,DAMAGE,AMOUNT")
- a:write("ITEM,DAMAGE,AMOUNT")
- for item, v in pairs(textutils.unserialize(data:match("return (.+)"))) do
- for damage, amount in pairs(v) do
- local str = item .. ',' .. tostring(damage) .. ',' .. tostring(amount)
- print(str)
- a:write(str .. '\n')
- end
- end
- a:close()
- print("Done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement