4 ms·
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 sc
by greggman2 7y ago
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.
- yanex 7y agoYou 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.
- orthoxerox 7y agoLua supports sandboxing via its _G variable, i.e., implicit global scope. When you call a script, you can pass it a custom _G.
- sdegutis 7y agoLua 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.