lua-users home
lua-l archive

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


> >> It's certainly a matter of taste, but... isn't calling the example
> >> metatable event "__env" needlessly confusing, given that there is no
> >> actual event called __env and _ENV means something else entirely?
> >
> > Sorry, but what "example" are you talking about?
> >
> > -- Roberto
> >
> 
> You can query the metatable of any value using the getmetatable
> function. Lua queries metamethods in metatables using a raw access
> (see rawget). So, to retrieve the metamethod for event env in object
> o, Lua does the equivalent to the following code:
> 
>      rawget(getmetatable(o) or {}, "__env")

Thanks. (The html has "__<em>env</em>", that's why I could not find
it...)

-- Roberto