jsonc: use json object new int64

This commit is contained in:
lean 2021-03-28 00:34:38 +08:00
parent 2f1c8833d5
commit 50d5286ab3

View File

@ -311,11 +311,9 @@ static struct json_object * _lua_to_json(lua_State *L, int index)
case LUA_TNUMBER:
nd = lua_tonumber(L, index);
ni = lua_tointeger(L, index);
if (nd == ni)
return json_object_new_int(nd);
if(nd >= INT64_MIN && nd <= INT64_MAX)
return json_object_new_int64(nd);
else
return json_object_new_double(nd);
case LUA_TSTRING: