lua-users home
lua-l archive

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


On 7/20/05, Ive <neosettlers@sympatico.ca> wrote:
> Hey thx for your help!
> 
> I have to solve the issue of using either one global lua_state or having
> one lua_sate per script!
> 
> What s the difference? Anyone can clear this up?
> 

If you have one per script, they can yield and be resumed
independently, so you can do things like stopping a script half-way to
resume its execution later, but you can still execute other scripts in
the meantime.

As I understand what you want to do from your first post, you want to
have one script per actor, and each time they are executed, they
update the actor's state.
I don't think you really need several different lua_State to do that.

In the project I'm working on, I didn't want the scripters to have to
explicitely write state machines, so I chose another approach where
the scripts call functions to initiate one or more action, are
suspended, and resumed when the action is finished.