fix: take handler for sol_lua_check as function reference (#6393)
* fix: take handler for `sol_lua_check` as function reference * changelog * fix: includes * uintptr type * fix: ub and eq
This commit is contained in:
@@ -40,7 +40,7 @@ void logError(Plugin *plugin, QStringView context, const QString &msg)
|
||||
// NOLINTBEGIN(readability-named-parameter)
|
||||
// QString
|
||||
bool sol_lua_check(sol::types<QString>, lua_State *L, int index,
|
||||
std::function<sol::check_handler_type> handler,
|
||||
chatterino::FunctionRef<sol::check_handler_type> handler,
|
||||
sol::stack::record &tracking)
|
||||
{
|
||||
return sol::stack::check<const char *>(L, index, handler, tracking);
|
||||
@@ -60,7 +60,7 @@ int sol_lua_push(sol::types<QString>, lua_State *L, const QString &value)
|
||||
|
||||
// QStringList
|
||||
bool sol_lua_check(sol::types<QStringList>, lua_State *L, int index,
|
||||
std::function<sol::check_handler_type> handler,
|
||||
chatterino::FunctionRef<sol::check_handler_type> handler,
|
||||
sol::stack::record &tracking)
|
||||
{
|
||||
return sol::stack::check<sol::table>(L, index, handler, tracking);
|
||||
@@ -92,7 +92,7 @@ int sol_lua_push(sol::types<QStringList>, lua_State *L,
|
||||
|
||||
// QByteArray
|
||||
bool sol_lua_check(sol::types<QByteArray>, lua_State *L, int index,
|
||||
std::function<sol::check_handler_type> handler,
|
||||
chatterino::FunctionRef<sol::check_handler_type> handler,
|
||||
sol::stack::record &tracking)
|
||||
{
|
||||
return sol::stack::check<const char *>(L, index, handler, tracking);
|
||||
@@ -115,10 +115,11 @@ namespace chatterino::lua {
|
||||
|
||||
// ThisPluginState
|
||||
|
||||
bool sol_lua_check(sol::types<chatterino::lua::ThisPluginState>,
|
||||
lua_State * /*L*/, int /* index*/,
|
||||
std::function<sol::check_handler_type> /* handler*/,
|
||||
sol::stack::record & /*tracking*/)
|
||||
bool sol_lua_check(
|
||||
sol::types<chatterino::lua::ThisPluginState>, lua_State * /*L*/,
|
||||
int /* index*/,
|
||||
chatterino::FunctionRef<sol::check_handler_type> /* handler*/,
|
||||
sol::stack::record & /*tracking*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#ifdef CHATTERINO_HAVE_PLUGINS
|
||||
# include "util/FunctionRef.hpp"
|
||||
# include "util/QMagicEnum.hpp"
|
||||
# include "util/TypeName.hpp"
|
||||
|
||||
@@ -174,12 +175,13 @@ void loggedVoidCall(const auto &fn, QStringView context, Plugin *plugin,
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||
# define SOL_STACK_FUNCTIONS(TYPE) \
|
||||
bool sol_lua_check(sol::types<TYPE>, lua_State *L, int index, \
|
||||
std::function<sol::check_handler_type> handler, \
|
||||
sol::stack::record &tracking); \
|
||||
TYPE sol_lua_get(sol::types<TYPE>, lua_State *L, int index, \
|
||||
sol::stack::record &tracking); \
|
||||
# define SOL_STACK_FUNCTIONS(TYPE) \
|
||||
bool sol_lua_check( \
|
||||
sol::types<TYPE>, lua_State *L, int index, \
|
||||
chatterino::FunctionRef<sol::check_handler_type> handler, \
|
||||
sol::stack::record &tracking); \
|
||||
TYPE sol_lua_get(sol::types<TYPE>, lua_State *L, int index, \
|
||||
sol::stack::record &tracking); \
|
||||
int sol_lua_push(sol::types<TYPE>, lua_State *L, const TYPE &value);
|
||||
|
||||
SOL_STACK_FUNCTIONS(chatterino::lua::ThisPluginState)
|
||||
|
||||
Reference in New Issue
Block a user