Lua sandbox¶
Enabled mods can change your world and inventories. They must not get operating-system power (files, processes, arbitrary .NET).
Allowed¶
- Hooks on your script table (
initialize,hitBlock,use, …) Worldhelpers (spawn, query tiles, explosions, time, …)Utilshelpers- Allowlisted proxies:
self.item,self.player, structure / flora / projectile proxies requireof scripts underContent/Lua, vanilla LoadedContent, and your pack
Banned¶
| Pattern | Why |
|---|---|
io.*, os.*, debug |
Host filesystem / process / debug |
import(...), luanet, LoadCLRPackage |
Full CLR interop |
dofile / unrestricted loadfile |
Load code outside the path jail |
package.loadlib |
Native libraries |
World.Map |
Raw map object — use World: helpers |
Mod Prep Validate flags many of these as errors before you publish. The game also strips 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.