Averages/Simple moving average: Difference between revisions

m (→‎{{header|D}}: Readability)
Line 656:
 
=={{header|Lua}}==
 
{{incorrect|Lua|The algorithm used fails to solve the task. If you need help then read another languages entry or I could expand on what I added in the talk page.}}
<lang lua>do
local nums, avt = 0, 0{}
function average(n)
if nums#t == 10 then avtable.remove(t, nums = 0, 01) end
nums, av = numst[#t + 1,] av += n
return avloadstring('return '..table.concat(t,'+'))() / nums#t
end
end
Anonymous user