Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

empty array advice #83

Open
OnlyPiglet opened this issue Feb 11, 2022 · 1 comment
Open

empty array advice #83

OnlyPiglet opened this issue Feb 11, 2022 · 1 comment

Comments

@OnlyPiglet
Copy link

OnlyPiglet commented Feb 11, 2022

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
Copy link
Author

OnlyPiglet commented Feb 11, 2022

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant