[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua states
- From: "Terry Bayne" <tbayne@...>
- Date: Tue, 20 May 2003 15:37:00 -0500
You might consider what I have done with multi-threaded programs in the past:
All threads communicate via Queues. Each thread monitors it's own queue. ALL inter-thread communication takes place by placing messages in the various Queues. Have a single thread that executes your LUA code, Feed it with it's own Queue.
One thing I have done recently was to use the Muscle Message data type as the Message type for Queues. See: http://www.lcscanada.com/muscle/
Hope this helps.
Terry
--Original Message Text---
From: Mihai Cozma
Date: Tue, 20 May 2003 22:35:43 +0300
Hi.I'm using lua embended in a game engine.i have the
folowing problem: i've crated a c++ object where i have an
array of lua_State * variables(one for history, one for simple
interpretor, one for renderer,..and so on).i use lua to give
orders to other objects stored in dlls.what i want to do is to
switch between states, so the command from the console goes to
the current state.so i've made another member of the c++
object like this: lua_State * currentstate; and i've
initialized it with NULL;so when i want to change the states i
assign to this memeber a lua state from the array and the
commands are executed only in the current state.well the
problem is it isn't working only if i declare all the threads
whom i want to assign another thread as a static memeber.and
this is not very good for my program design.if i don't do this
thing when i'm executing the program i get some adress
0x00..bla00bla cannot be "read".so i cannot go on.please tell
me why does this happens and how can i avoid the static
members.
thanks