Table that is synchronized with a specific file.
local config = FileTable:New("config.lua")
config.__comment = "Configuration of the program"
-- prints the last time the program was executed
-- stores the current time for next time
config.lastTime = os.time()
-- no further actions are necessary, the file is saved immediately
||Whenever any assignment is made to this table, it is immediatelly written to the associated file.
Creates a new instance of a FileTable mapped to the specified file.
The file cannot access any of the standard functions, as its envorinmont is overriden to be an empty table. That makes it safe, as it cannot access parts of a code it shouldn't touch, but it also isn't capable of using any standard functions -- meaning it has to be pure data.
path within the VFS corresponding to a Lua data file
Whenever any assignment is made to this table, it is immediatelly written to the associated file.
String that should be used as a comment on the beggining of the file.
anything not containing cycles
Forces the writing of the file.
It should usually not be necessary to call this method as the file gets saved whenever any change occurs. It might only be needed if the file holds nested tables and a change occurs there.
Replacement to using the regular pairs method.
This is necessary as one could otherwise not iterate over the keys due to the way FileTable is internally implemented.