Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Allow plugins to be separate resources #831

Open
GlitchMasta47 opened this issue Mar 24, 2024 · 2 comments
Open

Feature Request: Allow plugins to be separate resources #831

GlitchMasta47 opened this issue Mar 24, 2024 · 2 comments

Comments

@GlitchMasta47
Copy link

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

  • Don't create escrowed resources: if your resource is sold, then it's basically impossible to avoid someone leaking the code for free
  • Rely on server owners/developers to modify EasyAdmin's fxmanifest.lua to add dependencies: this can be done incorrectly by idiots less-knowledgeable users, and can cause issues in certain situations
@Blumlaut
Copy link
Owner

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

@GlitchMasta47
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants