mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Providing Backward Compatibility for BeamMP Lua
KiuToi provides almost full support for lua plugins with BeamMP. All necessary methods have been created, and testing has revealed the following nuances:
KiuToi does not support: MP.Set()
Economic Rework V2.0 (Paid, Discord (RU): Hlebushek)
- To obtain
pluginPath
, use:debug.getinfo(1).source:gsub("\\","/")
=>debug.getinfo(1).source:gsub("\\","/"):gsub("@", "")
as the path returns with@
, which broke the plugin.
Cobalt Essentials V1.7.5 (Free, github)
- To obtain
pluginPath
, use:debug.getinfo(1).source:gsub("\\","/")
=>debug.getinfo(1).source:gsub("\\","/"):gsub("@", "")
as the path returns with@
, which broke the plugin.
A Little About How it Works
Plugin loading goes through several stages:
- The
plugins/
folder is scanned. - If the folder is not in PyPlugins and there are
*.lua
files in the folder, then it is added as a plugin folder, let's say it will beplugins/LuaPlugin
- Next,
lua.loadfile({filename})
is performed from this folder (this is the standard method in lua). - Finally, the
onInit()
function is called, and an event is triggered. - If no errors occur during the execution of
onInit()
, you can see the messageLua plugins: LuaPlugin:ok
through thelua_plugins
command.