get number config value with optional default value * Get number config value from the game.project configuration file with optional default value * * @name sys.get_config_number * @param key [type:string] key to get value for. The syntax is SECTION.KEY * @param [default_value] [type:number] (optional) default value to return if the value does not exist * @return valu
| 564 | * ``` |
| 565 | */ |
| 566 | static int Sys_GetConfigNumber(lua_State* L) |
| 567 | { |
| 568 | DM_LUA_STACK_CHECK(L, 1); |
| 569 | |
| 570 | const char* key = luaL_checkstring(L, 1); |
| 571 | float default_value = 0; |
| 572 | if (!lua_isnone(L, 2)) |
| 573 | { |
| 574 | default_value = luaL_checknumber(L, 2); |
| 575 | } |
| 576 | |
| 577 | dmConfigFile::HConfig config_file = GetConfigFile(L); |
| 578 | if (config_file) |
| 579 | { |
| 580 | float value = dmConfigFile::GetFloat(config_file, key, default_value); |
| 581 | lua_pushnumber(L, value); |
| 582 | } |
| 583 | else |
| 584 | { |
| 585 | lua_pushnil(L); |
| 586 | } |
| 587 | return 1; |
| 588 | } |
| 589 | |
| 590 | /*# get boolean config value with optional default value |
| 591 | * Get boolean config value from the game.project configuration file with optional default value |
nothing calls this directly
no test coverage detected