MCPcopy Create free account
hub / github.com/crownengine/crown / lua_save_data_push_sjson_array

Function lua_save_data_push_sjson_array

src/lua/lua_api.cpp:729–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727static bool lua_save_data_push_sjson_object(lua_State *L, const char *value, bool &error, bool force_regular);
728
729static bool lua_save_data_push_sjson_array(lua_State *L, const char *value, bool &error)
730{
731 const int top = lua_gettop(L);
732 LuaStack stack(L, INT_MAX);
733 TempAllocator1024 ta;
734 JsonArray arr(ta);
735 sjson::parse_array(arr, value);
736 if (error) {
737 lua_settop(L, top);
738 return false;
739 }
740
741 stack.push_table(array::size(arr));
742 for (u32 ii = 0; ii < array::size(arr); ++ii) {
743 stack.push_key_begin(ii + 1);
744 if (!lua_save_data_push_sjson_value(L, arr[ii], error)) {
745 lua_settop(L, top);
746 return false;
747 }
748 stack.push_key_end();
749 }
750
751 return true;
752}
753
754static bool lua_save_data_parse_typed_object(DynamicString &type, const JsonObject &obj, bool &error)
755{

Callers 1

Calls 5

lua_gettopFunction · 0.50
parse_arrayFunction · 0.50
lua_settopFunction · 0.50
sizeFunction · 0.50

Tested by

no test coverage detected