whitelist = {} function save(whitelist,WL) local file = fs.open("WL","w") file.write(textutils.serialize(whitelist)) file.close() end function load(WL) local file = fs.open("WL","r") local data = file.readAll() file.close() return textutils.unserialize(data) end
These two functions are to save and load any changes to the white list within the program. to an external program called WL I figured that after I saved a name to a white list it would have no effect as I did not update or load the permanent white list into the white list "RAM" and therefore save another empty file.
term.clear() term.setCursorPos(2,2) write("Insert Player IGN > ") local IGN = read() table.insert(whitelist,IGN) save(whitelist,WL) term.clear() term.setCursorPos(2,2) write(IGN.." has been whitelisted.") sleep(2) term.clear() for i = 1,3 do term.setCursorPos(2,i+3) textutils.slowPrint(whitelist[i]) sleep(0.3) end
So what I am asking is how do I use the load function to load the serialised table from the external file into the whitelist variable within the program to create a working table add and remove system.
Edited by JustIan122, 03 September 2017 - 06:44 PM.