lua-users home
lua-l archive

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



On 07/09/2006, at 1:19 PM, Mark Edgar wrote:

You were very close.  Remember that this syntax:

local function g() end

is equivalent to

local g = function() end

and that the local statement creates a new local.

Yes I see that now, however I thought that the concept of "2 locals of the same name" is a bit strange.

For example, at global scope:

a = 22

a = 44

This does not create 2 copies of a - how can it, as "a" is held in one place: _G ['a']?

Thus I assumed that putting "local x" in twice would simply "reconfirm" that x is a locally declared variable inside its function.

Thanks for the quick response.

- Nick