| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
tableIO aims to be a simple lib to help saving application data from table files, being able to:
Serialization is essentially useful if you want to save data with another save mechanism instead of Lua's I/O, like love.filesystem from LÖVE game engine. (in this case is still possible to directly save and require the .lua, if instead of require, you use love.filesystem.load).
tableIO writes or serializes all (key,value) pairs where value is of any of these types:
Values of type function or nil will naturally get skipped (not written). It's not able to save metadata and userdata and will not work with tables with cycles.
tableIO contains 4 functions that can be called:
Saves table with io in a given path. Specially useful to save the table and require it when needed.
Parameters:
Returns:
Save a table to a opened file.
Parameters:
Returns:
Gets the tableIO serialization string of a given table. Can be written to a file to be read later.
Parameters:
Returns:
Converts a tableIO serialization string to a table.
Parameters:
Returns:
Simply require the script and call the save function:
local tableIO = require 'tableIO'
tableIO.save({key1 = 20, key2 = 'hello_world'},'myPath.lua')Require the file, using the path where it was saved
local myTable = require 'myPath'A more complete example, including serialization and deserialization is available in main.lua
| Back | FazBrowse Home | New Git URL |