diff --git a/scriptlib.h b/scriptlib.h index faf677e4..ad70b0c1 100644 --- a/scriptlib.h +++ b/scriptlib.h @@ -69,11 +69,11 @@ namespace scriptlib { template inline constexpr auto get_lua_param_type() { - if constexpr(std::is_same_v) + if constexpr(IsCard) return LuaParam::CARD; - if constexpr(std::is_same_v) + if constexpr(IsGroup) return LuaParam::GROUP; - if constexpr(std::is_same_v) + if constexpr(IsEffect) return LuaParam::EFFECT; if constexpr(std::is_same_v) return LuaParam::FUNCTION; @@ -245,7 +245,7 @@ namespace scriptlib { template inline bool lua_find_in_table_or_in_stack(lua_State* L, int idx, int max, T&& func) { - static_assert(std::is_same, bool>::value, "Callback function must return bool"); + static_assert(std::is_same_v, bool>, "Callback function must return bool"); if(lua_istable(L, idx)) { lua_pushnil(L); while(lua_next(L, idx) != 0) { @@ -275,15 +275,16 @@ namespace scriptlib { } template static int32_t from_lua_ref(lua_State* L) { + static_assert(IsCard || IsGroup || IsEffect); auto ref = lua_get(L, 1); lua_rawgeti(L, LUA_REGISTRYINDEX, ref); auto obj = lua_get(L, -1); if(!obj) { - if(std::is_same::value) + if constexpr(IsCard) lua_error(L, "Parameter 1 should be a lua reference to a Card."); - else if(std::is_same::value) + else if constexpr(IsGroup) lua_error(L, "Parameter 1 should be a lua reference to a Group."); - else if(std::is_same::value) + else if constexpr(IsEffect) lua_error(L, "Parameter 1 should be a lua reference to an Effect."); } return 1;