Add a new Channel API for experimental plugins feature (#5141)

This commit is contained in:
Mm2PL
2024-02-03 19:12:00 +01:00
committed by GitHub
parent 7fdb3841db
commit 8e9aa87a08
14 changed files with 1069 additions and 153 deletions
+12 -1
View File
@@ -137,6 +137,17 @@ public:
/// TEMPLATES
template <typename T>
StackIdx push(lua_State *L, std::optional<T> val)
{
if (val.has_value())
{
return lua::push(L, *val);
}
lua_pushnil(L);
return lua_gettop(L);
}
template <typename T>
bool peek(lua_State *L, std::optional<T> *out, StackIdx idx = -1)
{
@@ -262,7 +273,7 @@ StackIdx push(lua_State *L, QList<T> vec)
*
* @return Stack index of newly created string.
*/
template <typename T, std::enable_if<std::is_enum_v<T>>>
template <typename T, typename std::enable_if_t<std::is_enum_v<T>, bool> = true>
StackIdx push(lua_State *L, T inp)
{
std::string_view name = magic_enum::enum_name<T>(inp);