From 4e92144e9e48b54e14a4a370d814b8d003420afa Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 3 Dec 2021 17:00:12 +0800 Subject: [PATCH] perf: using nil replace userdata: (nil) while decoding string which contains null --- lua_cjson.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua_cjson.c b/lua_cjson.c index 22f33f12..fc5e117f 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -1253,9 +1253,7 @@ static void json_process_value(lua_State *l, json_parse_t *json, json_parse_array_context(l, json); break;; case T_NULL: - /* In Lua, setting "t[k] = nil" will delete k from the table. - * Hence a NULL pointer lightuserdata object is used instead */ - lua_pushlightuserdata(l, NULL); + lua_pushnil(l); break;; default: json_throw_parse_error(l, json, "value", token);