lua-users home
lua-l archive

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


>> Personally, I like declaring all locals since it prevents typos from
>> creating side-effects,

> How so?

The rest of my intended statement was... AND, declaring global writes.

function foo()
local bat -- oops, typo
bar = 10 -- this is a undeclared global write -> error
return bar
end

function foo()
local bar
bat = 10 -- oops, typo -- this is a undeclared global write -> error
return bar
end

Russ