Re: just a little question about the lua way :)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: just a little question about the lua way :)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: 2005年12月14日 15:02:42 -0200
> local function sumofn( a, ... )
> if not a then
> return 0
> else
> return a + sumofn(...)
> end
> end
The Lua way here would be
local function sumofn( a, ... )
return (a or 0) + sumofn(...)
end
And yes, this is not a tail call, as you can see by running luac -l.
--lhf