Lua sandbox¶
Enabled mods can change your world and inventories. They must not get operating-system power (files, processes, or arbitrary system libraries).
Allowed¶
- Hooks on your script table (
initialize,hitBlock,use, …) Worldhelpers (spawn, query tiles, explosions, time, …)Utilshelpers- Documented proxies:
self.item,self.armor,self.player,self.creature, structure / flora / projectile proxies requireof scripts underContent/Lua, the base game’s content scripts, and your pack
Banned¶
| Pattern | Why |
|---|---|
io.*, os.*, debug |
Host filesystem / process / debug |
import(...), luanet, LoadCLRPackage |
Bypass into the full game runtime |
dofile / unrestricted loadfile |
Load code outside the allowed folders |
package.loadlib |
Native libraries |
World.Map |
Raw map object — use World: helpers |
.Underlying |
Escape hatch into the full game object — sealed |
Mod Prep Validate flags many of these as errors before you publish. The game also blocks them at runtime. There is no “trusted mod” escape hatch.
Still powerful¶
Sandboxing stops host compromise. It does not stop a script from spawning items, dealing damage, or exploding terrain — those APIs exist so gameplay mods can work. Only enable packs you trust with your saves.