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

Function set_lua_state_value

src/Chain/libraries/glua/thinkyoung_lua_lib.cpp:1298–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1296 }
1297
1298 void set_lua_state_value(lua_State *L, const char *key, GluaStateValue value, enum GluaStateValueType type) {
1299 if (nullptr == L || nullptr == key || strlen(key) < 1) {
1300 return;
1301 }
1302
1303 L_V1 map = create_value_map_for_lua_state(L);
1304 GluaStateValueNode node_v;
1305 node_v.type = type;
1306 node_v.value = value;
1307
1308 if (node_v.type == LUA_STATE_VALUE_STRING)
1309 node_v.value.string_value = thinkyoung::lua::lib::malloc_and_copy_string(L, value.string_value);
1310
1311 std::string key_str(key);
1312 map->erase(key_str);
1313 map->insert(std::make_pair(key_str, node_v));
1314 }
1315
1316 static const char* reader_of_stream(lua_State *L, void *ud, size_t *size) {
1317 UNUSED(L);

Calls 5

malloc_and_copy_stringFunction · 0.85
make_pairClass · 0.50
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected