Difference between revisions of "libSaveTableToFile"

(Changed LOVE version to "Any".)
m (Added: Other Languages)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Disclaimer ==
+
On the [http://lua-users.org/wiki Lua Users Wiki] are a few solutions for serializing [[table]]s. This entry is about the one called [http://lua-users.org/wiki/SaveTableToFile Save table to file].
  
I did not write this library. This is just a pointer to what I find to be a very useful library for game development.
+
It provides two [[function]]s:
 +
* '''table.save(tbl, filename)''' saves a table to a text file.
 +
* '''table.load(filename)''' generates a table from the output file from <code>table.save()</code>.
  
== About ==
+
They allow you to easily save and load complex data. It uses [[Lua]] syntax for the data files, so it is easy to edit by hand.
  
This library converts tables into text documents and vise versa, thus allowing you to easily save and load data.  It uses the Lua syntax for the data files, so it is very easy to edit by hand.
+
It is licensed under the same [[MIT License|license as Lua]] and available
 
+
[http://lua-users.org/files/wiki_insecure/users/chill/table.save-0.94.lua here].
I find this better then directly writing saved files and running "dofile" on them because code cannot be executed, making it so that people can freely share level data files and so on without having to check them for Lua viruses.
 
 
 
== License ==
 
 
 
As of June 5, 2010, the library is licensed under the same license as Lua.
 
 
 
== Getting It ==
 
 
 
The library is accessible [http://lua-users.org/wiki/SaveTableToFile here] at the [http://lua-users.org/wiki Lua Wiki].
 
  
 
{{#set:LOVE Version=Any}}
 
{{#set:LOVE Version=Any}}
 
{{#set:Description=Load and save tables as text files.}}
 
{{#set:Description=Load and save tables as text files.}}
 +
{{#set:Keyword=Serializing}}
 
[[Category:Libraries]]
 
[[Category:Libraries]]
 +
== Other Languages ==
 +
{{i18n|libSaveTableToFile}}

Latest revision as of 15:58, 15 December 2019

On the Lua Users Wiki are a few solutions for serializing tables. This entry is about the one called Save table to file.

It provides two functions:

  • table.save(tbl, filename) saves a table to a text file.
  • table.load(filename) generates a table from the output file from table.save().

They allow you to easily save and load complex data. It uses Lua syntax for the data files, so it is easy to edit by hand.

It is licensed under the same license as Lua and available here.

Other Languages