lua-users home
lua-l archive

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


--[[
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