lua-users home
lua-l archive

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


Hey all,

In our game we utilize a single Lua_State, and create a co routine
(initialized with the main lua_state) for each other script we run.

It is great that the variables we create in these other scripts remain
global and accessible from any other script we run, however, we run
into this problem:


if we load 'scriptA.lua' which contains the function onClick()

and later load 'scriptB.lua' which doesn't contain an onClick()
function, the previous onClick function still remains.

so in short, when we run a script (through a co-routine) we would like
to start a clean slate as far as functions are concerned, but we still
want to be able to access all of the global variables we've created.

now, i noticed it is seemingly valid to create functions with the
'local' prefix on them, to me this sounds like what we need (so that
the functions don't get embedded into the global area) however I can't
figure out how to call a local function from C (all of our co-routine
creation, script loading, and function calling happens from C).

I am pretty sure someone has run into this issue before, any help
would be appreciated.

Thanks for your time,
Raymond Jacobs
Owner,
Ethereal Darkness Interactive