Module:Sandbox/sameboat2
Appearance
my_object = {};
function factorial(n)
if n == 0 then
return 1 --this returns the result 1 when passed zero
else
return n + factorial(n - 1)
end
end
my_object.hello = function( frame )
local arg1 = frame.args[1] or "1"
if tonumber( frame.args[1] ) == 3 then
arg1 = 20
end
local output = '';
for index = 1,arg1 do
output = output .. "\n|-" .. "\n|" .. index .. "||" .. index .. ") n! = " .. factorial(index)
end
return [[{|class="wikitable collapsible collapsed"]] .. "\n!colspan=3|Additive function til " .. arg1 .. "\n" .. output .. "\n|}";
end
return my_object