Jump to content

Module:User:Mr rnddude/Sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Modify it to a percentage calculation
Needs a "%" sign
 
Line 9: Line 9:
local num1 = tonumber(frame.args[1])
local num1 = tonumber(frame.args[1])
local num2 = tonumber(frame.args[2])
local num2 = tonumber(frame.args[2])
return num1 / num2 * 100
return num1 / num2 * 100 .. '%'
end
end



Latest revision as of 14:13, 6 March 2018

-- This is my module sandbox.
-- Simple pre-module for a
-- requested template.

local p = {}

function p.percent(frame) -- percentage (eventually)
	-- Percentage = share/total * 100
	local num1 = tonumber(frame.args[1])
	local num2 = tonumber(frame.args[2])
	return num1 / num2 * 100 .. '%'
end

return p