lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks for the info.  I got it working, but it only works for non-table values.  Even if I run:

table = {}
stable.set("table", table)
print("table: ", stable.get("table"))

it prints "table: nil", if I replace {} with 5 it prints "table: 5".  Is this something to do with the garbage collection, or something else entirely?

Thanks

Zach

On 2/3/07, Javier Guerra <javier@guerrag.com> wrote:
On Saturday 03 February 2007, Zach Dwiel wrote:
> What I'd like to do is have a system where all of the data for my server is
> contained in a large Lua data structure.  Where can I create this data
> structure so that A) it is only created once and B) is visible from every
> page on the server.  Every place I tried to create this data, it would only
> satisfy one of these properties ... It would be created once but not
> visible from lua pages, or would be visible and created every time a page
> was generated or viewed.

check the 'stable' facility of CGILua.  i think not all launchers support it,
at least mod_lua, FastCGI and Xavante do, but 'old CGI' doesn't (AFAIK)

as an anecdote, the code that later became Xavante started as a reaction to
the 'delete and recreate all state' approach of CGILua.  Xavante handlers are
simple functions on a long-lived environment.

but for the wide majority of cases the stable module is that's needed.

--
Javier