Jump to content

Module:Sandbox/x96lee15

From Wikipedia, the free encyclopedia
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