[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: "Proper" way to use lua
- From: "Matthew Harmon" <matt@...>
- Date: Thu, 14 Aug 2003 11:29:03 -0500
In our game application, it is possible for hundreds of game entities to be
running Lua scripts. (Well, they're yield()ed 99.999% of the time!) I
chose the course of creating a separate "thread" for each entity that uses a
script. I believe this has less overhead (somebody correct me if I'm
wrong.) It also has the benefit of allowing threads to communicate with
Additionally, you don't need to glue all your exposed functions separately
for each thread. The thread has access to all the functions and libraries
of the state to which it belongs.
So far... no troubles with this method.
[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?