Open sn8to opened 7 months ago
I think this is as simple as adding
addPlugin
to exports
passing functions between resources does not work, as resources are contained and funcrefs from resource A dont exist on resource B, without either passing sourcecode around (ew!) or using a mess of events (also ew, plus timing problems!) i dont think this can really be implemented.
- Don't create escrowed resources
is the only "real" solution for now
This is a pretty bad idea, I don't like it much, but I guess it would work? Maybe??
Provide an export to register an external plugin, EasyAdmin can use exports from the resource to register the plugin's functions. This would allow functions from other resources to be called, without using events and introducing timing/latency problems.
Something like this?
exports('registerPlugin', function(resourceName)
-- init the plugin using export[resourceName]:mainMenu(), etc.
end)
But I have a feeling similar issues come up when trying to pcall an exported function... Lua is fun
IIRC i was experimenting with exports before but as always there are timing and/or scope problems, you cant easily pass the scope around so all of it is kinda yucky and introduces fun race conditions..
Is your feature request related to a problem? Please describe. EasyAdmin has a pretty good plugin system that allows easily adding custom functionality, however these plugins have to be included within the EasyAdmin resource plugins folder. This prevents plugin authors from creating escrowed plugins, or implementing external dependencies within the plugin without modifying EasyAdmin's
fxmanifest.lua
Describe the solution you'd like Allow plugins to be registered and called from other resources. I think this is as simple as adding
addPlugin
to exports, but FiveM might throw a fit about passing functions around like that.Describe alternatives you've considered
fxmanifest.lua
to add dependencies: this can be done incorrectly byidiotsless-knowledgeable users, and can cause issues in certain situations