| 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); |
no test coverage detected