lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 1, 2014 at 7:14 PM, Thiago L. <fakedme@gmail.com> wrote:
> Lua is powerful but it needs more (string metatable) sandboxing... In Lua
> 5.1 it's possible but in Lua 5.2 it's completely impossible...
> My idea to fix it? Lua states in Lua states!

I would look at Lanes, as Thijs suggested; a Lua function can be
converted into a 'lane' running in its own Lua state (and OS thread)
in which you can do whatever global modifications you like, happily
sandboxed.

Separate Lua states are the ultimate sandbox because by design they
cannot share global state.  So Lanes does the hard work of copying
that function over to the new state, (even upvalues) and then the lane
can only communicate with other states by messaging (sending values
over channels called 'lindas')  So you also get a good solid
concurrency model as well as sandboxing.