json.encode and json.decode finished. Also lots of refactoring.
This commit is contained in:
@@ -56,6 +56,10 @@ static bool equivalent_values(LuaStack &MLS, LuaSlot mval, LuaSlot mtnmap,
|
||||
if (SLS.type(sval) != LUA_TSTRING) return false;
|
||||
return MLS.ckstring(mval) == SLS.ckstring(sval);
|
||||
}
|
||||
case LUA_TLIGHTUSERDATA: {
|
||||
if (SLS.type(sval) != LUA_TLIGHTUSERDATA) return false;
|
||||
return MLS.cktoken(mval) == SLS.cktoken(sval);
|
||||
}
|
||||
case LUA_TFUNCTION: {
|
||||
// Cannot really compare. Just return true if the types match.
|
||||
return SLS.type(sval) == MLS.type(mval);
|
||||
@@ -105,6 +109,11 @@ static void transmit_value(LuaStack &MLS, LuaSlot mval, LuaSlot mtnmap, StreamBu
|
||||
sb->write_string(MLS.ckstring(mval));
|
||||
return;
|
||||
}
|
||||
case LUA_TLIGHTUSERDATA: {
|
||||
sb->write_uint8(LUA_TLIGHTUSERDATA);
|
||||
sb->write_uint64(MLS.cktoken(mval).value);
|
||||
return;
|
||||
}
|
||||
case LUA_TT_GENERAL: {
|
||||
int midx = get_table_number(MLS, mval, mtnmap);
|
||||
if (midx == 0) {
|
||||
@@ -151,6 +160,10 @@ static void transmit_value_debug_string(StreamBuffer *sb, eng::ostringstream &os
|
||||
oss << sb->read_string();
|
||||
return;
|
||||
}
|
||||
case LUA_TLIGHTUSERDATA: {
|
||||
LuaToken token(sb->read_uint64());
|
||||
oss << "[" << token.str() << "]";
|
||||
}
|
||||
case LUA_TT_GENERAL: {
|
||||
oss << "table " << sb->read_int32();
|
||||
return;
|
||||
@@ -270,6 +283,12 @@ static void set_transmitted_value(LuaStack &LS, LuaSlot tangibles, LuaSlot ntmap
|
||||
LS.set(target, value);
|
||||
return;
|
||||
}
|
||||
case LUA_TLIGHTUSERDATA: {
|
||||
LuaToken value(sb->read_uint64());
|
||||
DebugLine(dbc) << dbinfo << "[" << value.str() << "]";
|
||||
LS.set(target, value);
|
||||
return;
|
||||
}
|
||||
case LUA_TT_GENERAL: {
|
||||
int index = sb->read_int32();
|
||||
DebugLine(dbc) << dbinfo << "table " << index;
|
||||
|
||||
Reference in New Issue
Block a user