From bb412340db054c423600770a1071555b8d50dfd9 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 4 Feb 2023 02:23:36 +0100 Subject: [PATCH] Use lua convention for main file in package: init.lua --- docs/wip-plugins.md | 4 ++-- src/controllers/plugins/PluginController.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/wip-plugins.md b/docs/wip-plugins.md index e5bb52ef2..b12893fde 100644 --- a/docs/wip-plugins.md +++ b/docs/wip-plugins.md @@ -13,11 +13,11 @@ Each plugin should have its own directory. ``` Chatterino dir/ └── plugin_name/ - ├── index.lua + ├── init.lua └── info.json ``` -`index.lua` will be the file loaded when the plugin is enabled. You may load other files using `loadfile` Lua global function. +`init.lua` will be the file loaded when the plugin is enabled. You may load other files using `loadfile` Lua global function. `info.json` contains metadata about the plugin, like its name, description, authors, homepage link, tags, version, license name. The version field **must** diff --git a/src/controllers/plugins/PluginController.cpp b/src/controllers/plugins/PluginController.cpp index ba7bb3bbf..8dab91345 100644 --- a/src/controllers/plugins/PluginController.cpp +++ b/src/controllers/plugins/PluginController.cpp @@ -4,7 +4,7 @@ # include "Application.hpp" # include "common/QLogging.hpp" # include "controllers/commands/CommandContext.hpp" -# include "controllers/plugins/ApiChatterino.hpp" +# include "controllers/plugins/LuaApi.hpp" # include "controllers/plugins/LuaUtilities.hpp" # include "messages/MessageBuilder.hpp" # include "providers/twitch/TwitchIrcServer.hpp" @@ -72,17 +72,17 @@ void PluginController::actuallyInitialize() } bool PluginController::tryLoadFromDir(const QDir &pluginDir) { - // look for index.lua - auto index = QFileInfo(pluginDir.filePath("index.lua")); - qCDebug(chatterinoLua) << "looking for index.lua and info.json in" + // look for init.lua + auto index = QFileInfo(pluginDir.filePath("init.lua")); + qCDebug(chatterinoLua) << "looking for init.lua and info.json in" << pluginDir.path(); if (!index.exists()) { qCDebug(chatterinoLua) - << "Missing index.lua in plugin directory" << pluginDir; + << "Missing init.lua in plugin directory" << pluginDir; return false; } - qCDebug(chatterinoLua) << "found index.lua, now looking for info.json!"; + qCDebug(chatterinoLua) << "found init.lua, now looking for info.json!"; auto infojson = QFileInfo(pluginDir.filePath("info.json")); if (!infojson.exists()) {