(03-02-2011, 05:57 AM)FakeTruth Wrote: Each plugin (read .lua file, each .lua file can have multiple plugins) has its own stack.
I don't know if it's possible to call functions between plugins, I haven't tried this yet. I believe it is possible to include other .lua files in your .lua file, then use cPluginManager:GetPlugin( Plugin Name ) to get a pointer to a cPlugin object, then you might be able to call functions on it... though I'm not sure.
Yeah, that's the problem/limitation that each plugin has its own stack.
If all share same stack sharing data or functions between the plugins would be no problem (altough other problems may arise).
I'm in need of such mechanism as i plan to build plugins on each other.
e.g. AreaPlugin connects with a Economy Plugin to sell land. Also it might be the matter that some plugin checks the permissions of the AreaPlugin (like ItemDrop has to check a locked area).
(03-02-2011, 07:25 AM)FakeTruth Wrote: 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:
Code:virtual Lua_Table CustomFunc( string a_SomeParameter );
Please no C/C++ interface between Lua Plugins!
This would limit all benefits you have from Lua.
I strongly suggest using one common stack.