lua-users home
lua-l archive

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


On 2012-12-05 7:36 PM, "Claire Lewis" <claire_lewis@live.com.au> wrote:
>
> So hang on, would this mean that, as a host app or module writer, I can no longer rely on this to work:
>  
>   t = { 1,2,3 }
>   print(t[2])
>   -> 2
>  
> if some other module or user script has gone and installed a ‘clever’ type metatable?
>  
> I realise this is currently the case with string, but there’s a lot less incentive to do clever things with that.
>  
> Like I said, I like the concept, but I wonder if there is some way this could be made _ENV bound, or similar, to avoid nasty side-effects in other modules.
>  
> - Claire.
>  
>  
It's a metatable, so __index would still work the same as it always has.