lua-users home
lua-l archive

Re: Fast marshalling / serialisation system

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


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

AltStyle によって変換されたページ (->オリジナル) /