lua-users home
lua-l archive

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

On 11-Nov-04, at 11:54 AM, Mark Hamburg wrote:

 Is it useful to be able
to capture a variable and then create a new variable with the same name in
what appears to be the same scope?

I just remembered another (perhaps odd) use of nested scoping: to wrap a
script into a function call while keeping a function argument (or local)
protected from the script:

script = [[
  function(secret, a)
  -- do something with secret
    local secret = nil
]] .. script .. [[
  return secret