lua-users home
lua-l archive

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

It was thus said that the Great Jason White once stated:
> Hello Lua mailing list, I am trying to add scripting support to a game I'm
> writing. If I have 2 functions `init` and `update` in a script plus a few
> global variables. I want to run multiple instances of this script within
> the game. How could I do that without name space conflicts ? I have a few
> ideas about doing this* but I'd like advise on what the "best" way would
> be to do this without making the scripter jump through too many hoops
> since I'm fairly new to Lua.

  The easiest way is to have a separate lua_State for each instance.  There
are ways of doing this with just a single lua_State but things get more
involved at that point.