Posted 26 November 2018 - 07:31 PM
Probably a stupid question, but I was trying to save a table to file, but it has a function in it, and it gave me a 'Cannot serialize type function' error, is there anyway I an rewrite this in a way for it to work?
local file = fs.open("/system/software/commands/corecmds.lua","w")
commands = {}
commands.help = {
["Name"]='help',
["Usage"]="[ Type 'Help' For A List Of Commands ]",
["Runtime"]= function() printCentered(math.floor(h/2) -3+i, '[ Listing Commands... ]') for i=1,#placeholder do printCentered(math.floor(h/2) -2+i, "Placeholder") end end,
}
file.write(textutils.serialize(commands))
file.close()
Edited on 26 November 2018 - 06:33 PM