lua-users home
lua-l archive

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


> On 7 Apr 2014, at 07:36, Joachim Bürmann <jbuermann@iftools.com> wrote:
> 
> Both Lua interpreters are called alternately from C++ and execute the same Lua script.


For this to work, you can't use os threads, the scripts must be run alternately in a single os thread.

> I'm wondering if it is possible to share a 'global' lua table created in
> C++ between two running Lua interpreter instances.

First thought is to run the two bits of code in two separate threads in the same state. If not I would look into LuaProxy. It lets you access variables in one state through a userdata in another. The userdata acts like the global table of the other state I think.

I don't know if it's possible, but you might be able to use it so that each state can access the other one, or both can access the same 3rd state with your table in.

Thanks,
Kevin