Module:Sandbox/sameboat: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
-- defines a factorial function |
|||
local p = {} |
|||
function |
function fact (n) |
||
if n == 0 then |
|||
return 1 |
|||
else |
|||
return 'Hello, my ' .. arg1 .. ' is ' ..arg2 |
|||
return n * fact(n-1) |
|||
⚫ | |||
end |
|||
function p.silly(frame) |
|||
⚫ | |||
local arg1 = frame.args[1] or "" |
|||
local arg2 = frame.args[2] or "" |
|||
print("enter a number:") |
|||
return 'Silly, your ' .. arg1 .. ' was ' ..arg2 |
|||
a = io.read("*number") -- read a number |
|||
end |
|||
print(fact(a)) |
|||
return p |