lua-users home
lua-l archive

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

--- Russ Webb <> wrote:
> Personally, I like declaring all locals since it prevents typos from
> creating side-effects,

How so?

function foo()
  local bat -- oops, typo
  bar = 10
  return bar

function foo()
  local bar
  bat = 10 -- oops, typo
  return bar

In either case you've just created a new global, or worse, you've just changed the value of an
existing global. Right?

Do You Yahoo!?
Yahoo! Health - your guide to health and wellness