lua-users home
lua-l archive

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


On Mar 19, 2013, at 3:52 PM, Kaj Eijlers <bizziboi@gmail.com> wrote:

> >>Like strict.lua, this only covers undefined globals.
> 
> Well, if a local isn't defined it's supposed to look for the global. If that wasn't the case you couldn't use globals anymore (except prefixing em all),,,,,,so the global metatable seems to be the mst useful mechanism for detecting undefined variables.
> If you didn't define a local, and a global exists, it's technically not undefined.
> 
> Or do you mean to trap nil on table members (ie in a class system)? Then you gotta set the metatable on that table.
> 
> But having it look for a local and not falling back to globals seems rather un-Lua to me.
> 
> Kaj
> 

I'm talking about ALL attempted accesses of undefined variables, including table/array/class elements. I was wondering if addressing this in a major version update of the language has been considered before and if there are reasons for retaining the current behavior.

Preston