lua-users home
lua-l archive

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


Waldemar Celes wrote:
> > BOOL CloneObject(lua_State *fromstate,lua_Object *O,lua_State *tostate);
> 
> you have to use the host to transfer the data from one state to the
> other. so, you can implement such a function as long as the lua object
> to be cloned hold only numbers, strings and userdata.
> 
> -- waldemar

So what if I need the tables also (And perhaps functions) ?

My senario is like this:

1. I have one thread running with Lua - No problems
2. User uses a function that start a new thread (And a new Lua State)
3. The new thread needs a copy of some (The selection is not a problem)
of the objects
4. Clone Function is used
5. Both threads are now running

Another serinaro could be:

1. Two threads are running (Each with a state)
2. Thread A wants to give Thread B a object (Syncronisation of threads
is a not problem - Each thread has a message queue and sync. is done
thru that (With performance loss for thread A - but that is OK!)
3. Clone function is used
4. Both threads continue to run


Erik