lua-users home
lua-l archive

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

On Wed, Oct 29, 2008 at 11:48 AM, Joonhwan Lee <> wrote:
> Question 1: Is there any way of sharing table data between different
> lua_State ?

add a userdata that represents your table, and a few methods to call
getters/setters in your app.

> Question 2: I'd love to use only on lua_State and push data once into table
> on that lua_State still running many lua scripts on this lua_State. Is this
> possibe?  I'd be appreciate if anyone points me a good example source or
> link .

yes, it is.  the main hurdle is if you want to load/unload Lua scripts
without disrupting the whole state.  the unloading part is the hard
one.  you might it doable if you block the lua scripts from modifying
the global environment, and give each it's own environment table.
that way you can just set to nil all references to each scripts code
and data, and reload.

or just don't allow reloading.  to modify a script restart the app.
far easier but more cumbersome if you want to allow third-party

in any case, simply store each loaded script in a variable (or a
table's element) and call when needed.