Re:Lua 5.4.0 beta
by greggman2 on Thursday October 03, 2019 @12:26PM
(#21148786)
This is probably not the right place to ask but ..., given that Lua is commently embedded in games, anyone know of a sandboxed version? I'd love to provide a scripting language for user mods to a game but I'd like as much as possible to not have to trust the mods.
[ Parent
| on HN ]
You can choose what parts of the standard library scripts allowed to use. Just exclude os/debug libraries, and that's it. Newer versions of the Programming in Lua book contain detailed instructions.
Lua is extremely sandboxable from hosting C. Just only add modules, functions and features you want added. Makes good use of the C preprocessor flags too. But also check out QuickJS as a neat alternative. But it probably doesn’t compare in speed to LuaJIT which is mostly the flavor used I think.
Re:Lua 5.4.0 beta
by orthoxerox on Thursday October 03, 2019 @12:52PM
(#21149062)
Lua supports sandboxing via its _G variable, i.e., implicit global scope. When you call a script, you can pass it a custom _G.