MCPcopy Create free account
hub / github.com/axmolengine/axmol / json_process_value

Function json_process_value

3rdparty/lua/lua-cjson/lua_cjson.c:1257–1287  ·  view source on GitHub ↗

Handle the "value" context */

Source from the content-addressed store, hash-verified

1255
1256/* Handle the "value" context */
1257static void json_process_value(lua_State *l, json_parse_t *json,
1258 json_token_t *token)
1259{
1260 switch (token->type) {
1261 case T_STRING:
1262 lua_pushlstring(l, token->value.string, token->string_len);
1263 break;;
1264 case T_NUMBER:
1265 lua_pushnumber(l, token->value.number);
1266 break;;
1267 case T_INTEGER:
1268 lua_pushinteger(l, token->value.integer);
1269 break;;
1270 case T_BOOLEAN:
1271 lua_pushboolean(l, token->value.boolean);
1272 break;;
1273 case T_OBJ_BEGIN:
1274 json_parse_object_context(l, json);
1275 break;;
1276 case T_ARR_BEGIN:
1277 json_parse_array_context(l, json);
1278 break;;
1279 case T_NULL:
1280 /* In Lua, setting "t[k] = nil" will delete k from the table.
1281 * Hence a NULL pointer lightuserdata object is used instead */
1282 lua_pushlightuserdata(l, NULL);
1283 break;;
1284 default:
1285 json_throw_parse_error(l, json, "value", token);
1286 }
1287}
1288
1289static int json_decode(lua_State *l)
1290{

Callers 3

json_parse_array_contextFunction · 0.85
json_decodeFunction · 0.85

Calls 8

lua_pushlstringFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushintegerFunction · 0.85
lua_pushbooleanFunction · 0.85
json_parse_array_contextFunction · 0.85
lua_pushlightuserdataFunction · 0.85
json_throw_parse_errorFunction · 0.85

Tested by

no test coverage detected