lua-cjson icon indicating copy to clipboard operation
lua-cjson copied to clipboard

empty array advice

Open OnlyPiglet opened this issue 3 years ago • 1 comments

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?

OnlyPiglet avatar Feb 11 '22 08:02 OnlyPiglet

@agentzh @dndx if you have break time.please have a look at this issue. thanks.

OnlyPiglet avatar Feb 11 '22 08:02 OnlyPiglet