Open xiayong968 opened 4 years ago
That is bug same to #12.
json::object obj;
lua_pushnil(L);
while (lua_next(L, index) != 0) {
if (lua_type(L, -2) == LUA_TSTRING) {
const char* key = lua_tostring(L, -2);
json::value& b = obj[key];
b = to_json(L, -1, max_recursive - 1);
} else if (lua_type(L, -2) == LUA_TNUMBER) {
const char* key = "";
if (lua_isinteger(L,-2)){
lua_Integer temp = lua_tointeger(L, -2);
key = int64_to_string(temp);
} else{
double temp = lua_tonumber(L, -2);
key = double_to_string(temp);
}
json::value& b = obj[key];
b = to_json(L, -1, max_recursive - 1);
}
lua_pop(L, 1); // pop value
}
local t = {} t[1000] = "hi"
when break the script,the table t show empty,is it a bug?