lua-users home
lua-l archive

Re: Simulating Lua states in Lua with only 250 lines of code

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


On 26/06/15 06:23 AM, Tim Hill wrote:
On Jun 25, 2015, at 10:17 AM, Soni L. <fakedme@gmail.com> wrote:
On 25/06/15 02:16 AM, Tim Hill wrote:
On Jun 24, 2015, at 10:56 AM, Soni L. <fakedme@gmail.com> wrote:
You can't get enclosing closures.
function f()
 -- _ENV = _ENV -- redundant because we're making g a global, so we need _ENV
 function g() (""):doSomething() end -- function has no _ENV
end
-- good luck getting the env of g :P
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.
function g() (""):doSomething(_ENV) end
—Tim
And how does that help with SANDBOXING the string metatable?
I mean, you'd be running untrusted code…
It doesn’t and it wasn’t intended to. If you need to sandbox Lua functions you need a different approach.
—Tim
Lua States (from C) work well for sandboxing. I don't see why we SHOULDN'T have them available as coroutines. I believe the debug API should make Lua side just as powerful as C side (at least when it comes to VM interaction).
--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.

AltStyle によって変換されたページ (->オリジナル) /