Module:Sandbox/RexxS/GCI07

From Wikipedia, the free encyclopedia
-- Module to demonstrate a simple numerical 'for' loop for Google-Code-in-2017
--
-- The function 'times' displays a mathematical "times-table"
-- The number base for the times-table is passed as parameter "num"
-- If no parameter or a blank parameter or a value less than 2 is passed, use 2

p = {}

p.times = function(frame)
	local num = tonumber( frame.args.num ) or 2
	local out = "Times table<br>"
	for i = 1, 10 do
		out = out .. i * num .. "<br>"
	end
	return out
end

return p