lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
> The "idiomatic" Lua way would be to use get/setglobal tag methods, but this 
> does not handle locals or table fields, as has already been pointed. 

It really would be nice to be able change how Lua looks up local variables from within Lua. This would allow variable references in object methods to automatically look in self (as in many OO languages) if a local doesn't match. 

Example:

function Person:fullName()
  return self.title.." "..self.firstName.." "..self.lastName
end

Could become:

function Person:fullName()
  return title.." "..firstName.." "..lastName
end

Steve