mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Modernize lua read (part 2 & 3): C++ templating assurance (#7410)
* Modernize lua read (part 2 & 3): C++ templating assurance Implement the boolean reader Implement the string reader Also remove unused & unimplemented script_error_handler Add a reader with default value
This commit is contained in:
parent
227c71eb76
commit
eef62c82a2
35 changed files with 247 additions and 154 deletions
|
@ -102,7 +102,7 @@ int LuaSettings::l_get_bool(lua_State* L)
|
|||
} else {
|
||||
// Push default value
|
||||
if (lua_isboolean(L, 3))
|
||||
lua_pushboolean(L, lua_toboolean(L, 3));
|
||||
lua_pushboolean(L, readParam<bool>(L, 3));
|
||||
else
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ int LuaSettings::l_set_bool(lua_State* L)
|
|||
LuaSettings* o = checkobject(L, 1);
|
||||
|
||||
std::string key = std::string(luaL_checkstring(L, 2));
|
||||
bool value = lua_toboolean(L, 3);
|
||||
bool value = readParam<bool>(L, 3);
|
||||
|
||||
SET_SECURITY_CHECK(L, key);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue