lua-users home
lua-l archive

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


Aaron Brown skrev:
Javier wrote:

while next (t) do
        t[next(t)]=nil
end

This doesn't work if false is a key.


Easily fixed by checking specifically for non nil keys:

while next(t) ~= nil do
	t[next(t)] = nil
end

However, another way to go about the "my submodules may have references..." is to use weak references (but then they'll have to check that their reference is still valid before using them).

//Andreas