I've been trying to pass a LuaTable class between two Lua states, like so:
LuaManager L1 = new Lua();
LuaManager L2 = new Lua();
LuaTable table = L1.DoString("return {apple = 25}")[0];
L2["tbl"] = table;
double results = L2.DoString("return tbl[\"apple\"]")[0];
Assert.AreEqual(25.0, results);
The above test fails; I receive a return value of nil. Using the Immediate Window confirms that "table" is a non-null object, and that table["apple"] returns 25; it's something that's being lost in translation to L2.
Interestingly, when the object is loaded back into the same state, the test works, like so:
//Succeeds
LuaManager lua = new Lua();
LuaTable table = lua.DoString("return {apple = 25}")[0];
lua["tbl"] = table;
double results = lua.DoString("return tbl[\"apple\"]")[0];
Assert.AreEqual(25.0, results);
How can I safely pass the LuaTables without hassles? Thanks in advance!