[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Redefining locals
- From: "Aaron Brown" <aaron-lua@...>
- Date: Thu, 11 Nov 2004 09:13:01 -0500
--[[
Rich Artym wrote:
> Aha, so it must actually be possible to access the old
> overridden scope still in some way. I haven't figured
> out how to do that yet. Example?
I can think of no practical use, but here's an example:
--]]
local foo = 1
function incrementfirstfoo()
foo = foo + 1
print(foo)
end -- incrementfirstfoo
local foo = 1
print(foo) -- prints 1
incrementfirstfoo() -- prints 2
print(foo) -- prints 1
incrementfirstfoo() -- prints 3
print(foo) -- prints 1
incrementfirstfoo() -- prints 4
print(foo) -- prints 1
incrementfirstfoo() -- prints 5
print(foo) -- prints 1
-- Aaron