[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Sharing objects between states
- From: STPeters <stefan@...>
- Date: Wed, 03 Aug 2011 00:08:09 -0700
*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
http://forum.luahub.com/index.php?topic=3138.msg7072 - 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++.