[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: adventures with iterators
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 3 Dec 2012 07:21:03 +0200
2012/12/2 Sven Olsen <sven2718@gmail.com>:
> Either way though, in my own use case, any form of delayed
> writing is almost certain to be a case study in the evils of
> premature optimization. I have small table sizes, and plenty of
> spare CPU cycles and memory, so sticking with something
> conceptually simple, if theoretically inefficient, is almost
> certain to be my best bet.
In that case, I recommend the "keys" function from Steve's
Microlight library.
> ml=require"ml"
> =ml.keys
function: 0x9cd9d38
> for _,k in ipairs(ml.keys(t)) do
if k==5 then
t[k]=nil
t[4]=0
t[1622]=0
end
end
> for k,v in pairs(t) do print(k,v) end
1 0
3 0
4 0
12 0
1622 0