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

feat(scheduler.lua): add require function to load scripts at runtime (Lazy Loading) #736

Closed
wants to merge 5 commits into from
Closed

Conversation

0xWaleed
Copy link

@0xWaleed 0xWaleed commented Jun 11, 2021

This require function will load scripts at runtime, it works like lua's original require function that is being disable by CFX
for security reasons. this will use CFX natives to load scripts instead of adding them to client_script or server_script entries.
Also this will help to do lazy loading scripts on demand.

usage: will be the same as lua require function. we don't use / for directory separator not the .lua extension to make it same as lua on other platforms.

require('resource-name.dir.dir.script') 

As per the cfx documentation with client side, you need to add the file to file entry in fxmanifest in order to load it at runtime.

Thank you blattersturm for your points for my previous PR, I changed what you mentioned in order to meet the requirements.
feel free to add changes that I need to work on.

#735

@0xWaleed 0xWaleed changed the title feat(scheduler.lua): add require function load scripts at runtime (Lazy Loading) feat(scheduler.lua): add require function to load scripts at runtime (Lazy Loading) Jun 11, 2021
@blattersturm
Copy link
Contributor

again?

@citizenfx citizenfx locked as too heated and limited conversation to collaborators Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants