Module:User:Mr rnddude/Sandbox
Appearance
-- This is my module sandbox.
-- The below is simplistic practice for
-- working out how to write simpler modules.
-- My first foray into modules was overly
-- complex. Successful, but, complex.
local p = {}
function p.add (frame) -- simple addition
local num1 = tonumber(frame.args[1])
local num2 = tonumber(frame.args[2])
return num1 + num2
end
function p.multiply (frame) -- similarly, simple multiplication
local num1 = tonumber(frame.args[1])
local num2 = tonumber(frame.args[2])
return num1 * num2
end
function p.secondlaw (frame) -- Newton's second law of motion
local num1 = tonumber(frame.args[1])
local num2 = tonumber(frame.args[2])
return 'Force =' .. num1 * num2
end