diff --git a/src/Lib/Script/CRTPLuaScriptObject.hh b/src/Lib/Script/CRTPLuaScriptObject.hh index 6772bb5a779fd79e8354e9c37499a71a47494b7f..d90a5fb8f23ff84cc4491fbbad992de95d7b5945 100644 --- a/src/Lib/Script/CRTPLuaScriptObject.hh +++ b/src/Lib/Script/CRTPLuaScriptObject.hh @@ -21,11 +21,8 @@ namespace Vivy::Script #define script_class(theClassName) \ class theClassName final : public CRTPLuaScriptObject<theClassName> -#define LUA_DECL_GETTER(type, luaName, value) \ - static int luaName(lua_State *const L) noexcept \ - { \ - return luaPushValue<type>(L, CHECK(L, 1)->value); \ - } +#define LUA_DECL_GETTER(type, luaName, value) \ + static int luaName(lua_State *const L) noexcept { return luaPushValue(L, CHECK(L, 1)->value); } #define LUA_SCRIPTABLE_CLASS_MANUAL_CTOR(theClassName) \ VIVY_UNMOVABLE_OBJECT(theClassName) \ @@ -68,24 +65,22 @@ protected: } // Push something onto the stack, must be specialized - template <typename T> static int luaPushValue(lua_State *const L, const T &thing) noexcept; using std_str = std::string; using std_strv = std::string_view; - template <> static int luaPushValue<int>(lua_State *const L, const int &thing) noexcept + static int luaPushValue(lua_State *const L, const int &thing) noexcept { lua_pushinteger(L, thing); return 1; } - template <> - static int luaPushValue<std_strv>(lua_State *const L, const std_strv &thing) noexcept + static int luaPushValue(lua_State *const L, const std_strv &thing) noexcept { lua_pushlstring(L, thing.data(), thing.size()); return 1; } - template <> static int luaPushValue<std_str>(lua_State *const L, const std_str &thing) noexcept + static int luaPushValue(lua_State *const L, const std_str &thing) noexcept { lua_pushstring(L, thing.c_str()); return 1;