lua-users home
lua-l archive

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

*NOTE: this is being asked on behalf of a Lua forum user. I thought this came up before on the list, but can't seem to find it, and I am stumped. I can pass along the info, or you can reply directly at - thanks for your time!


Can an object be created in one Lua state, passed to C++, and then passed to a script running in a different Lua state?

The reason I ask is that I'd like scripts responsible for object creation to have a different set of available APIs than the scripts which later control the object, as well as run on a different thread (native thread - each of these interpreters in turn contains many Lua threads). They will never be accessing the object at the same time.

Does the use of Luabind, as opposed to native C wrappers, affect the answer to this question?

They are derived from a C++ base class, with virtual functions reimplemented in Lua (and called from C++ with Luabind glue), and instantiated from Lua. So I guess that makes them Lua objects used by C++.