1
0
Fork 0
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:
Loïc Blot 2018-06-30 17:11:38 +02:00 committed by GitHub
parent 227c71eb76
commit eef62c82a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 247 additions and 154 deletions

View file

@ -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);