From eef62c82a2e58700fc1216b0b8c03e421bc77995 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sat, 30 Jun 2018 17:11:38 +0200 Subject: 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 --- src/script/lua_api/l_settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/script/lua_api/l_settings.cpp') diff --git a/src/script/lua_api/l_settings.cpp b/src/script/lua_api/l_settings.cpp index 1d56aed5f..cc2c73789 100644 --- a/src/script/lua_api/l_settings.cpp +++ b/src/script/lua_api/l_settings.cpp @@ -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(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(L, 3); SET_SECURITY_CHECK(L, key); -- cgit v1.2.3