lua-users home
lua-l archive

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


Alexander Gladysh wrote:
2. Something really weird: I also need something (an __eq
meta-method?) which would catch implicit comparison with nil (or
false) like this:

  if t then
     print "t is not nil"
  else
     print "t is nil"
  end

I need to be able to simulate nil (or false) value here when t is a
meta-tabled table.

Are you trying to implement some kind of proxy for objects that can be collected/destroyed outside of Lua?
If so, I would recommend you explicit check here:

if not t.isAlive then
...
end

Happy New Year!