[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Forward declarations in modules
- From: Mark Edgar <medgar@...>
- Date: Thu, 07 Sep 2006 17:25:28 -0700
Nick Gammon wrote:
Yes I see what is happening, but the surprising thing is that local
variables behave so much differently to other types of variables.
Jerome's excellent post explains this. Using local with assignment is
syntactic sugar for a local declaration followed by an assignment.
Separating the local declaration from the assignment allows you to "see"
what is really happening:
b = 3 -- modifies _G.b
b = 4 -- modifies _G.b
a = 3 -- modifies local a
a = 4 -- modifies local a