lua-cjson
lua-cjson copied to clipboard
empty array advice
decode empty array string and encode the lua table into empty array automaticly.
I add the code in this place in the file lua_cjson.c ,it works.
/* Handle empty arrays */
if (token.type == T_ARR_END) {
lua_pushlightuserdata(l, json_lightudata_mask(&json_empty_array)); //added
lua_rawget(l, LUA_REGISTRYINDEX); //added
lua_setmetatable(l, -2); //added
json_decode_ascend(json);
return;
}
I. think the off diffience between after_decoded_empty_array table and raw lua empty table is that the after_decoded_empty_array has a empty metadata table. yes?
@agentzh @dndx if you have break time.please have a look at this issue. thanks.