[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fast marshalling / serialisation system
- From: "Wim Couwenberg" <wim.couwenberg@...>
- Date: Wed, 21 Mar 2007 19:45:09 +0100
David, you could also consider to construct the item directly on the
other stack, instead of marshalling. Here's the rough idea:
/* copy object from one universe to another.
both universes must be locked during this
copy operation. */
void copy(lua_State *to, lua_State *from, int index)
{
switch (lua_type(from, index))
{
case LUA_TNIL:
lua_pushnil(to);
break;
case LUA_TNUMBER:
lua_pushnumber(to, lua_tonumber(from, index));
break;
case LUA_TSTRING:
lua_pushstring(to, lua_tostring(from, index));
break;
...
}
}
The LUA_TTABLE case is the most difficult, but not too hard, depending
on how advanced you want to make it.
--
Wim