[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extract a list of keys from table
- From: Shmuel Zeigerman <shmuz@...>
- Date: Fri, 18 Jul 2008 14:22:38 +0300
steve donovan wrote:
Can be a little suprising if the function takes multiple values ;)
map(print,10,20,30)
10 20 30 20 30 30
Yes, but the function choice are the programmer's :)
If we want to make it "idiot-proof" (to safeguard against ourselves :)
), we can add an extra pair of parentheses:
function map(func, ...)
if select("#", ...) > 0 then
return func((...)), map(func, select(2,...))
end
end
--
Shmuel