lua-users home
lua-l archive

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


On Fri, Jul 18, 2008 at 12:32 PM, Shmuel Zeigerman <shmuz@bezeqint.net> wrote:
> While we at it, here's a simpler "function mapper" variant:
>  function map(func, ...)
>    if select("#", ...) > 0 then
>      return func(...), map(func, select(2,...))
>    end
>  end

Can be a little suprising if the function takes multiple values ;)

> map(print,10,20,30)
10 20 30 20 30 30

steve d.