OK.
I did some testing, and thinking, and I don't think it's possible to call newly declared functions on a plugin because you can't typecast in Lua AFAIK and what you do in Lua isn't really extending/inheriting the cPlugin class but faking it.
I think I will add one basic function to cPlugin:
I suck at coming up with function names, so it's open for discussion lol.
Anyway, this allows you to do ... anything?
PluginOne:
PluginTwo
----
On second thought, I might make the parameter for CustomFunc a Lua table as well, this makes it much easier to send complex data to the plugin.
Discuss!
I did some testing, and thinking, and I don't think it's possible to call newly declared functions on a plugin because you can't typecast in Lua AFAIK and what you do in Lua isn't really extending/inheriting the cPlugin class but faking it.
I think I will add one basic function to cPlugin:
Code:
virtual Lua_Table CustomFunc( string a_SomeParameter );
I suck at coming up with function names, so it's open for discussion lol.
Anyway, this allows you to do ... anything?
PluginOne:
Code:
function PluginOne:CustomFunc( Params )
Split = StringSplit( Params )
if( Split[1] == "MakeGod" )
MakeGod( Split[2] ) -- Blabla, this function makes dude in Split[2] god
end
end
PluginTwo
Code:
function PluginTwo:OnChat( Message, Player )
PluginManager = cRoot:Get():GetPluginManager()
OtherPlugin = PluginManager:GetPlugin("PluginOne")
if( OtherPlugin ~= nil )
OtherPlugin:CustomFunc("MakeGod " .. Player:GetName() ) -- Make all chatting players god! whee~
end
end
----
On second thought, I might make the parameter for CustomFunc a Lua table as well, this makes it much easier to send complex data to the plugin.
Discuss!