lua-users home
lua-l archive

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

>It really would be nice to be able change how Lua looks up local variables from within Lua.

I think that having tag methods for locals would kill the performance edge
of local variables.

>function Person:fullName()
>  return self.title.." "..self.firstName.." "..self.lastName
>Could become:
>function Person:fullName()
>  return title.." "..firstName.." "..lastName

I don't see how ag methods for locals would help here: title, firstName,
lastName would be parsed as *global* variables.
You'd have to declare them as local, but in this case, why not write
 local title, firstName, lastName = self.title, self.firstName, self.lastName