CGILua
CGILua 5.0
Distributed libraries

home · cookies · serialize · session · stable

Cookies

cgilua.cookies.get (name)

Gets the value of the named cookie.
Returns a string with the value of the cookie.

cgilua.cookies.set (name, value[, options])

Sets the value of the named cookie. This function should be called before the HTTP header is sent and before any output is generated.
Returns nothing.

cgilua.cookies.sethtml (name, value[, options])

Sets the value of the named cookie. This function generates a <meta> HTML element so it should be called after the <head> HTML tag was produced and before the <body>.
Returns nothing.

cgilua.cookies.delete (name[, options])

Deletes the value of the named cookie (by setting its value to xxx). Returns nothing.

Serialize

cgilua.serialize (table, outfunc, indent, prefix)

Serializes a table. Argument table is the table to be serialized; outfunc is a function used to generate the output; indent is an optional string with the indentation pattern; prefix is an optional string with the indentation prefix (it is used to store the actual indentation between the recursion calls).
Some restrictions must be noted: values of types function and userdata could not be serialized; also, tables with cycles are not serialized.
Returns nothing.

Session

cgilua.session.close ()

Closes user session. Saves all data in cgilua.session.data to the storing system. This function should be called after the end of the script's execution. A recommended way to do that is by calling addclosefunction in the configuration file.
Returns nothing.

cgilua.session.data

Table which holds session data.

cgilua.session.delete (id)

Deletes a session. The argument is the session identifier.
Returns nothing.

cgilua.session.load (id)

Loads data from a session. The argument is the session identifier.
Returns a table with session data or nil followed by an error message.

cgilua.session.new ()

Creates a new session identifier.
Returns the new session identifier.

cgilua.session.open ()

Opens user session. Creates table cgilua.session.data. This function should be called just before the execution of the script, but after the processing of the request's headers. Therefore it must be added to the opening functions list (see addopenfunction) in the configuration file.
Returns nothing.

cgilua.session.save (id, data)

Saves data to a session. Argument id is a session identifier; argument data is a table with session data to be saved.
Returns nothing.

cgilua.session.setsessiondir (path)

Changes the session temporary directory. Argument path is a string with the new directory.
Returns nothing.

Stable (state table)

stable.get (key)

Retrieves the value of a given key.
Returns any value.

stable.set (key, value)

Stores a value associated to a key.
Returns nothing.
$Id: libraries.html,v 1.13 2004/12/15 15:11:48 tomas Exp $