aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/luaengine.h
diff options
context:
space:
mode:
authorMarcus Tillmanns <[email protected]>2024-04-19 14:03:25 +0200
committerMarcus Tillmanns <[email protected]>2024-04-19 13:54:11 +0000
commitf91d071c66ac60e0339626a0ceb41b4b4f8f1fcc (patch)
tree5a9e1645c4d9f84ad9ea81914dfed4e4f110c5f5 /src/plugins/lua/luaengine.h
parent3350afeb61b0da874ac277ddd1648cd6d536b231 (diff)
Lua: Clean up pass
Fixing constness, removing unused function, adding LuaEngine::variadicToStringList Change-Id: If567ac83c04e5ce6f973c819f303c9cb790b3948 Reviewed-by: <[email protected]> Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/lua/luaengine.h')
-rw-r--r--src/plugins/lua/luaengine.h22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/plugins/lua/luaengine.h b/src/plugins/lua/luaengine.h
index 3246c7de19b..0ea78e0211a 100644
--- a/src/plugins/lua/luaengine.h
+++ b/src/plugins/lua/luaengine.h
@@ -43,27 +43,20 @@ public:
Utils::expected_str<LuaPluginSpec *> loadPlugin(const Utils::FilePath &path);
static void registerProvider(const QString &packageName, const PackageProvider &provider);
- static void autoRegister(std::function<void(sol::state_view)> registerFunction);
- static void registerHook(QString name, std::function<void(sol::function)> hookProvider);
+ static void autoRegister(const std::function<void(sol::state_view)> &registerFunction);
+ static void registerHook(QString name, const std::function<void(sol::function)> &hookProvider);
static Utils::expected_str<void> connectHooks(sol::state_view lua, const sol::table &hookTable);
static bool isCoroutine(lua_State *state);
- static sol::table toTable(sol::state_view lua, const QJsonValue &v);
+ static sol::table toTable(const sol::state_view &lua, const QJsonValue &v);
static QJsonValue toJson(const sol::table &t);
- static Utils::expected_str<int> resumeImpl(sol::this_state s, int nargs);
-
- template<typename... Args>
- static Utils::expected_str<int> resume(sol::this_state s, Args &&...args)
- {
- sol::stack::push(s, std::forward<Args>(args)...);
- return resumeImpl(s, sizeof...(Args));
- }
+ static QStringList variadicToStringList(const sol::variadic_args &vargs);
template<typename R, typename... Args>
- static Utils::expected_str<R> safe_call(sol::protected_function function, Args &&...args)
+ static Utils::expected_str<R> safe_call(const sol::protected_function &function, Args &&...args)
{
sol::protected_function_result result = function(std::forward<Args>(args)...);
if (!result.valid()) {
@@ -78,7 +71,8 @@ public:
}
template<typename... Args>
- static Utils::expected_str<void> void_safe_call(sol::protected_function function, Args &&...args)
+ static Utils::expected_str<void> void_safe_call(
+ const sol::protected_function &function, Args &&...args)
{
sol::protected_function_result result = function(std::forward<Args>(args)...);
if (!result.valid()) {
@@ -90,7 +84,7 @@ public:
protected:
Utils::expected_str<void> connectHooks(
- sol::state_view lua, const sol::table &table, QString path);
+ sol::state_view lua, const sol::table &table, const QString &path);
private:
std::unique_ptr<LuaEnginePrivate> d;