Paul Isambert <[email protected]> a écrit:
> You can easily fake it:

Since we were mentionning type(), this should have been, more properly:

> table.foreach = table.foreach or
>   function (t, f)
>     for k, v in pairs(t) do
>       local ret = f(k, v)
>       if ret then return ret end

        if type(ret) ~= "nil" then return ret end

>     end
>   end

(And the same for foreachi.)

Paul

Reply via email to