get string config value with optional default value * Get string config value from the game.project configuration file with optional default value * * @name sys.get_config_string * @param key [type:string] key to get value for. The syntax is SECTION.KEY * @param [default_value] [type:string] (optional) default value to return if the value does not exist * @return valu
| 479 | * ``` |
| 480 | */ |
| 481 | static int Sys_GetConfigString(lua_State* L) |
| 482 | { |
| 483 | DM_LUA_STACK_CHECK(L, 1); |
| 484 | |
| 485 | const char* key = luaL_checkstring(L, 1); |
| 486 | const char* default_value = 0; |
| 487 | if (lua_isstring(L, 2)) |
| 488 | { |
| 489 | default_value = lua_tostring(L, 2); |
| 490 | } |
| 491 | |
| 492 | dmConfigFile::HConfig config_file = GetConfigFile(L); |
| 493 | if (config_file) |
| 494 | { |
| 495 | const char* value = dmConfigFile::GetString(config_file, key, default_value); |
| 496 | lua_pushstring(L, value); |
| 497 | } |
| 498 | else |
| 499 | { |
| 500 | lua_pushnil(L); |
| 501 | } |
| 502 | return 1; |
| 503 | } |
| 504 | |
| 505 | /*# get integer config value with optional default value |
| 506 | * Get integer config value from the game.project configuration file with optional default value |
nothing calls this directly
no test coverage detected