mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Use lua convention for main file in package: init.lua
This commit is contained in:
parent
4030439766
commit
bb412340db
2 changed files with 8 additions and 8 deletions
|
@ -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**
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue