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

Function lua_cjson_safe_new

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

Return cjson.safe module table */

Source from the content-addressed store, hash-verified

1418
1419/* Return cjson.safe module table */
1420static int lua_cjson_safe_new(lua_State *l)
1421{
1422 const char *func[] = { "decode", "encode", NULL };
1423 int i;
1424
1425 lua_cjson_new(l);
1426
1427 /* Fix new() method */
1428 lua_pushcfunction(l, lua_cjson_safe_new);
1429 lua_setfield(l, -2, "new");
1430
1431 for (i = 0; func[i]; i++) {
1432 lua_getfield(l, -1, func[i]);
1433 lua_pushcclosure(l, json_protect_conversion, 1);
1434 lua_setfield(l, -2, func[i]);
1435 }
1436
1437 return 1;
1438}
1439
1440int luaopen_cjson(lua_State *l)
1441{

Callers 1

luaopen_cjson_safeFunction · 0.85

Calls 4

lua_cjson_newFunction · 0.85
lua_setfieldFunction · 0.85
lua_getfieldFunction · 0.85
lua_pushcclosureFunction · 0.85

Tested by

no test coverage detected