FiveM Lua sandbox IO and OS lib patches
Due to FiveM's inclusion of Lua sandboxing in the latest build, this feature prevents your scripts from using functions such as io.open
, io.popen
, and os.execute
. This script reimplements the io and os libraries using JavaScript, to allow you to utilize the aforementioned functions.
Clone this repository into your resources folder.
git clone https://github.com/ZeroDream-CN/sandbox-patches
Add the following to your server.cfg
file:
ensure sandbox-patches
Note: This resource must be started before any other resources that use the os
or io
libraries.
Add the following to your resource's fxmanifest.lua
file:
server_script '@sandbox-patches/patches.lua'
or like this:
server_scripts {
'@sandbox-patches/patches.lua',
'server.lua' -- your other server scripts
}
Then you can use io
and os
functions as usual.
This project is licensed under the MIT License - see the LICENSE file for details.