This code will help to call functions of other plugins, like they're just libraries:
After adding this file in start of main file, all you need to call functions from other plugins is to call PF.PluginName.FunctionName(...), for example if you need to call a function named "CoolFunction" from plugin named "CoolPlugin", you can do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | PF={} local function hasPlugin(name) return cPluginManager:DoWithPlugin(name, function (Plugin) if Plugin:IsLoaded() then return true end return false end ) end setmetatable (PF,{ __index= function (s,i) if not hasPlugin(i) then return nil end local pluginName=i return setmetatable ({},{ __index= function (s,i) return function (...) cPluginManager:CallPlugin(pluginName,i,...) end end }) end }) |
Code:
PF.CoolPlugin.CoolFunction(...)