[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about erasing tables
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 3 Jul 2017 16:33:39 -0300
> In Chapter 2, Roberto mentions that "If you want to erase all elements from a table, a simple traversal is the correct way to do it:
>
> for k in pairs(t) do
> t[k] = nil
> end
>
> Roberto then goes on to mention an improvement to this:
>
> while true do
> local k = next(t)
> if not k then break end
> t[k] = nil
> end
Did you turn the page? :-)
-- Roberto