lua-users home
lua-l archive

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


On Wed, Aug 8, 2012 at 3:58 PM,  <mchalkley@mail.com> wrote:
> I sure wish I'd asked the question 4 hours ago...

Don't worry, we've all done things like that. Eventually through pain
and experience we learn that handful of global functions by heart and
avoid them as variables.

There are some defensive strategies.  Some people start off their
modules like this:

local G = _G

(_G is another global, and just refers to the global table itself, so
type == _G["type"])

And then it's G.type, G.print, and so forth.  Then your variables
won't collide with them!

steve d.