Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 076646c0 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

SCRIPT: Get ride of some templated function for gcc to be happy about the code that it must compile

parent 34632648
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -22,10 +22,7 @@ namespace Vivy::Script
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); \
}
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;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter