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_base.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/script/lua_api/l_base.h') diff --git a/src/script/lua_api/l_base.h b/src/script/lua_api/l_base.h index d0160f03b..12c1a86cc 100644 --- a/src/script/lua_api/l_base.h +++ b/src/script/lua_api/l_base.h @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_types.h" #include "common/c_internal.h" +#include "common/helper.h" #include "gamedef.h" extern "C" { @@ -37,7 +38,7 @@ class Server; class Environment; class GUIEngine; -class ModApiBase { +class ModApiBase : protected LuaHelper { public: static ScriptApiBase* getScriptApiBase(lua_State *L); @@ -69,17 +70,4 @@ public: const char* name, lua_CFunction func, int top); - - static bool isNaN(lua_State *L, int idx); - - /** - * Read a value using a template type T from Lua State L and index - * - * @tparam T type to read from Lua - * @param L Lua state - * @param index Lua Index to read - * @return read value from Lua - */ - template - static T readParam(lua_State *L, int index); }; -- cgit v1.2.3