lua-users home
lua-l archive

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


On Thu, Aug 7, 2014 at 9:47 AM, Mason Mackaman <masondeanm@aol.com> wrote:
> I think the reason I’m still confused is I’m not understanding how this works. I figured when you do str:len(), you still have to access the global ‘string’ table, because that’s what the __index metamethod is for ‘str’s metatable. In which case it would be more work. Are you saying str:len() retrieves the ‘len' function without having to get _ENV.table?

That's exactly what's being said here. Going from str to str's
metatable doesn't involve any external lookups at all.

/s/ Adam