lua-users home
lua-l archive

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


I am trying to figure out how to use sessions with CGILUA. The test
file test_session.lua that comes with the source does not work when I
run it in Apache (or Xavante). Apache provides a better stack trace
for some reason. here's what it says:

test_session.lua:4: bad argument #1 to `pairs' (table expected, got nil)
stack traceback:
 [C]: in function `pairs'
 test_session.lua:4: in function `pt'
 test_session.lua:44: in main chunk
[[...I cut the rest out, it isn't important...]]


it appears the function 'pt' (which is a function in test_session.lua)
is being called with nil, and it expects a table. Well I could
obviously fix this so it didn't throw an error, but the problem is
that 'cgilua.data' (which I guess is where session data is supposed to
go) does not exist. If I create the variable myself then it does not
maintain it as session data (it gets cleared on postback).

I guess this is probably just because something has changed between
versions, but I can't figure out how to use sessions just by looking
at the docs. I don't know if/when any of those functions need to be
called.

Can anyone help me out?

Chris