lua-users home
lua-l archive

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


On Tue, Jan 26, 2016 at 6:11 PM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Soni L. once stated:
>> pairs() is considered harmful, and can cause bugs:
>> https://github.com/MightyPirates/OpenComputers/issues/1625
>
>   Could not reproduce.

(...)

>   My Lua 5.1 and 5.2 are the latest version, but I think I'm still a bit
> behind on 5.3 (5.3.0), so that may have some effect.  But otherwise ... what
> exactly is going on?
>
>   -spc

It looks like the OpenComputers project uses a sandbox that overrides
setmetatable() with a custom-written wrapper, that involves use of
pairs().

Search for 'setmetatable =', here:
https://github.com/MightyPirates/OpenComputers/blob/master-MC1.7.10/src/main/resources/assets/opencomputers/lua/machine.lua

(Disclaimer: I don't know anything about the OpenComputers project,
this is the first I've heard of it. If I have misunderstood the
situation, I apologise.)

-Duncan