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

Function lua_save_data_push_table

src/lua/lua_api.cpp:930–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

928}
929
930static bool lua_save_data_push_table(lua_State *L, const void *data)
931{
932 const int top = lua_gettop(L);
933 CE_ENSURE(data != NULL);
934 if (data == NULL)
935 return false;
936
937 bool parse_error = false;
938 sjson::set_error_callback([](const char *msg, void *user_data) {
939 CE_UNUSED(msg);
940 *(bool *)user_data = true;
941 }
942 , &parse_error
943 );
944
945 const bool parsed = lua_save_data_push_sjson_object(L, (const char *)data, parse_error, false);
946 sjson::set_error_callback(NULL, NULL);
947
948 if (!parsed || parse_error) {
949 lua_settop(L, top);
950 return false;
951 }
952
953 return true;
954}
955
956void load_api(LuaEnvironment &env)
957{

Callers 1

load_apiFunction · 0.85

Calls 4

set_error_callbackFunction · 0.85
lua_gettopFunction · 0.50
lua_settopFunction · 0.50

Tested by

no test coverage detected