Jump to content

Module:Sandbox/x96lee15

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by X96lee15 (talk | contribs) at 18:48, 24 March 2016 (interim commit). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}
function p.hello(frame)
    return 'Hello, my' .. frame.args[1] .. ' is ' .. frame.args[2]
end

function p.winning_percentage(frame)
	
end

function percentage (wins, losses, ties)
	total_games = wins + losses + ties
	win_and_tie_points = wins + (ties / 2)
	
	if (wins < 0   or
		losses < 0 or
		ties < 0) then
		return_value = "ERROR: Negative game totals"
	elseif (total_games == 0) then
		return_value = "ERROR: No game totals"
	else
		return_value = win_and_tie_points / total_games
	end
	
	return return_value
end

return p