lua-users home
lua-l archive

Re: just a little question about the lua way :)

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


Hi,
Asko Kauppi wrote:
> Sometimes, "making it Lua" may mean that you're actually making it 
> harder for those PHP/C/etc. people to understand.
"Making it Lua" => "Making it simple".
There's absolutely nothing wrong with:
local function sumtable(tab)
 local sum = 0
 for _,x in ipairs(tab) do sum = sum + x end
 return sum
end
And in fact this is the fastest solution, too.
Bye,
 Mike

AltStyle によって変換されたページ (->オリジナル) /