MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / json_to_lua

Function json_to_lua

src/Chain/libraries/glua/ljsonlib.cpp:334–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334static int json_to_lua(lua_State *L)
335{
336 if (lua_gettop(L) < 1)
337 return 0;
338 if (!lua_isstring(L, 1))
339 return 0;
340 auto json_str = luaL_checkstring(L, 1);
341 thinkyoung::lua::lib::GluaStateScope scope;
342 auto token_parser = std::make_shared<GluaTokenParser>(scope.L());
343 token_parser->parse(std::string(json_str));
344 token_parser->reset_position();
345 bool result = false;
346 auto value = tokens_to_lua_value(L, token_parser.get(), &result);
347 if (!result)
348 {
349 return 0;
350 }
351 lua_push_storage_value(L, value);
352 return 1;
353}
354
355static int lua_to_json(lua_State *L)
356{

Callers

nothing calls this directly

Calls 9

lua_gettopFunction · 0.85
lua_isstringFunction · 0.85
tokens_to_lua_valueFunction · 0.85
lua_push_storage_valueFunction · 0.85
LMethod · 0.80
reset_positionMethod · 0.80
stringClass · 0.50
parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected