package
and require
in MissionScripting.lua
require
and package
in MultiplayerRe-enabling require
and package
in MissionScripting.lua
allows mission scripts to load external Lua modules—but
this comes with security risks in multiplayer:
require
arbitrary Lua files, potentially chaining
code in unintended ways.require
, making it easy to run hidden or unsafe
code.Only enable require
/package
in trusted environments. For safer distribution, use option 1
instead.
To use Pelican in the MSE, you will need to remove the sanitization of the package
and require
functions in the
MissionScripting.lua
file.
This file is located in the Scripts
folder of your DCS World installation, for example:
⚠️ Two dashes
--
are used to comment out the code, so you can remove the sanitization of thepackage
andrequire
-- C:\Program Files\Eagle Dynamics\DCS World\Scripts\MissionScripting.lua
--Initialization script for the Mission lua Environment (SSE)
dofile("Scripts/ScriptingSystem.lua")
--Sanitize Mission Scripting environment
--This makes unavailable some unsecure functions.
--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
--You can remove the code below and make availble these functions at your own risk.
local function sanitizeModule(name)
_G[name] = nil
package.loaded[name] = nil
end
do
sanitizeModule("os")
sanitizeModule("io")
--sanitizeModule('lfs')
--_G['require'] = nil
_G["loadlib"] = nil
--_G['package'] = nil
end
Once you have modified the MissionScripting.lua
file, you can use Pelican in your mission scripts without any
restrictions on the package
and require
functions.