lua-users home
lua-l archive

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


> I think that <toclose> is more powerful since it let you to define an
> object in a scope, but close it in another one.

do -- scope1
  local <toclose> obj1 = my_complex_object(1)
  local obj2 = my_complex_object(2)
  local <toclose> obj3
  local <toclose> obj4
  local <toclose> obj5
  do -- scope2
    obj3 = my_complex_object(3)
    obj4 = my_complex_object(4)
    obj5 = my_complex_object(5)
    obj4 = nil
    obj5 = my_complex_object(55)
 end -- end of scope 2
end -- end of scope 1

And what should be the difference in the fates of obj1, obj2, obj3,
obj4 and obj5 ?