lua-users home
lua-l archive

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


> 	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