Module:BonusMalus

function BonusMalus(number,mode) local temp = "" if number == 0 then if mode == "TEXT" or mode == "TEXT_PERC" then temp = "\'\'No bonus\'\'" end elseif number < 0 then if mode == "PERC" or mode == "TEXT_PERC" then temp = "\'\'\'" .. number .. "% \'\'\'"		else temp = "\'\'\'" .. number .. " \'\'\'"	end else if mode == "PERC" or mode == "TEXT_PERC" then temp = "\'\'\'+" .. number .. "% \'\'\'"		else temp = "\'\'\'+" .. number .. " \'\'\'"	end end return temp end function BonusMalus2(number) local temp = "" if number == 0 then temp = "\'\'0\'\'" elseif number < 0 then temp = "\'\'\'" .. number .. " \'\'\'"	else temp = "\'\'\'+" .. number .. " \'\'\'"	end return temp end

local p = {} function p.main(frame) return BonusMalus(tonumber(frame.args[1]),frame.args[2]) end function p.sheet(frame) return BonusMalus2(tonumber(frame.args[1])) end return p