[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: "Proper" way to use lua
- From: virgil@... (Virgil Smith)
- Date: Thu, 14 Aug 2003 10:25:55 -0500
Lua has no problem with having hundreds of open states (that's just a matter
of memory allocation for all of those state structures). The kicker is of
course that a script (chunk) runs in just one Lua state. So if you want a
script to be able to access multiple of your classes/instances you will need
to register them into the same Lua state. Also, if you want separate
scripts to be able to modify/create globals that later scripts access you
will need to run those scripts in the same Lua state.
For help with exporting class instances into Lua check out tolua.
[mailto:email@example.com]On Behalf Of Jeff Williams
Sent: Thursday, August 14, 2003 10:17 AM
Subject: "Proper" way to use lua
I am adding scripting to my program using lua. I am curious if my method is
in line with the general philosophy behind lua or if I am doing things
completely the wrong way.
For each instance of a class in my program, I create a lua state for the
instance (it is a member var) and then I register funcs with that lua state.
Is this the way I should do it? Or should there only be one lua state in
the entire program and all my clases share that state?
I guess ultimately my question is more like:
Is lua designed to have hundreds of open states? or just a few?