get boolean config value with optional default value * Get boolean config value from the game.project configuration file with optional default value * * @name sys.get_config_boolean * @param key [type:string] key to get value for. The syntax is SECTION.KEY * @param [default_value] [type:boolean] (optional) default value to return if the value does not exist * @return
| 603 | * ``` |
| 604 | */ |
| 605 | static int Sys_GetConfigBoolean(lua_State* L) |
| 606 | { |
| 607 | DM_LUA_STACK_CHECK(L, 1); |
| 608 | |
| 609 | const char* key = luaL_checkstring(L, 1); |
| 610 | bool default_value = false; |
| 611 | if (!lua_isnone(L, 2)) |
| 612 | { |
| 613 | default_value = lua_toboolean(L, 2); |
| 614 | } |
| 615 | |
| 616 | dmConfigFile::HConfig config_file = GetConfigFile(L); |
| 617 | if (config_file) |
| 618 | { |
| 619 | int32_t int_value = dmConfigFile::GetInt(config_file, key, default_value ? 1 : 0); |
| 620 | bool value = int_value != 0; |
| 621 | lua_pushboolean(L, value); |
| 622 | } |
| 623 | else |
| 624 | { |
| 625 | lua_pushnil(L); |
| 626 | } |
| 627 | return 1; |
| 628 | } |
| 629 | |
| 630 | /*# open url in default application |
| 631 | * Open URL in default application, typically a browser |
nothing calls this directly
no test coverage detected