From eef62c82a2e58700fc1216b0b8c03e421bc77995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= 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/cpp_api/s_security.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/script/cpp_api/s_security.cpp') diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index 6c50218d3..e87f16ddd 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -524,7 +524,7 @@ bool ScriptApiSecurity::checkPath(lua_State *L, const char *path, // Get mod name lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME); if (lua_isstring(L, -1)) { - std::string mod_name = lua_tostring(L, -1); + std::string mod_name = readParam(L, -1); // Builtin can access anything if (mod_name == BUILTIN_MOD_NAME) { @@ -649,7 +649,7 @@ int ScriptApiSecurity::sl_g_loadfile(lua_State *L) lua_pop(L, 1); if (script->getType() == ScriptingType::Client) { - std:: string display_path = lua_tostring(L, 1); + std::string display_path = readParam(L, 1); const std::string *path = script->getClient()->getModFile(display_path); if (!path) { std::string error_msg = "Coudln't find script called:" + display_path; -- cgit v1.2.3