diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-30 17:11:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 17:11:38 +0200 |
commit | eef62c82a2e58700fc1216b0b8c03e421bc77995 (patch) | |
tree | 4c49e659069036cb53d69535dc33d33f29d963f4 /src/script/lua_api/l_settings.cpp | |
parent | 227c71eb76e019873b30e2d3893b68307d51d58f (diff) | |
download | minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.tar.gz minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.tar.bz2 minetest-eef62c82a2e58700fc1216b0b8c03e421bc77995.zip |
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
Diffstat (limited to 'src/script/lua_api/l_settings.cpp')
-rw-r--r-- | src/script/lua_api/l_settings.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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<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); |