lua-users home
lua-l archive

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


> On Jun 23, 2015, at 4:46 PM, Daurnimator <quae@daurnimator.com> wrote:
> 
> As I replied on IRC; I think that lexically scoped metatables for the
> base types are a much better idea.
> I even coded up a proof of concept:
> https://gist.github.com/daurnimator/dedd793e6f9b1f8d6b0c
> (obviously if such a feature made it into PUC-lua, the `debug` calls
> would be unnessecary)
> 

I’m scratching my head on the utility of something like this.

Besides, if you want it, then the existing _ENV mechanism can do this for you. Just wrap the type in a metatable (a trivial bit of C code) and have it’s metamethods defer to functions in the current environment.

This is really the beauty of Lua; it’s meta-language model that provides the facilities whereby YOU can easily add these features without having to encumber the base language.

—Tim