Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Data saving for Lua
Lua
Branch: master
Failed to load latest commit information.
examples 1.2.0
state now uses the freedesktop specs
.gitignore you dont want this
CHANGELOG renamed project
LICENSE first commit
README.textile renamed project

README.textile

lstate

lstate is a Lua library which allows easy and painless storing of tables in Lua.

Dependencies

How to install (with LuaRocks)

Run the command luarocks install state

How to install (Manually)

Put the folder state somewhere in your Lua module path.
On Linux/Mac this is usually something like /usr/local/share/lua/5.1/.
On Windows it’s C:\Program Files\Lua\5.1\.

How to use

Take a look at this example:

require("state")
-- initialize our data table
data = {aVariable = ""}
-- if there is a previous state, load it
local st = state.load("exampleStateProgram")
if st then data = st end
-- print the variable
print("Stored variable: "..data.aVariable)
-- store a new value
io.write("Input a value to be stored: ")
data.aVariable = io.read("*line")
-- save the table
state.store("exampleStateProgram", data)

Easy, isn’t it?

Something went wrong with that request. Please try again.