This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
subzero22's profile picture

saving table's help

Started by subzero22, 05 March 2016 - 12:35 AM
subzero22 #1
Posted 05 March 2016 - 01:35 AM
Ok I'm testing a piece of code for my main program but for some reason when saving a table to a file puts nil in the file.


local todo={"a","b"}

function save(todo,tlist)
local file = fs.open(tostring("tlist"),"w")
file.write(textutils.serialize(todo))
file.close()
end

save()
Edited on 05 March 2016 - 12:36 AM
Lyqyd #2
Posted 05 March 2016 - 01:40 AM
You aren't passing anything to the save function, so its arguments will be nil.
subzero22 #3
Posted 05 March 2016 - 02:05 AM
ah ok thanks it works now