local function createPhaseDisplayer(phaseValues, progressSymbol, backgroundSymbol)
local phasesCount = #phaseValues
local currentPhase = 0
return function ()
currentPhase = currentPhase + 1
if currentPhase > phasesCount then
os.exit()
end
local indicatorFirstPart = string.rep(progressSymbol, currentPhase)
local indicatorSecondPart = string.rep(backgroundSymbol, phasesCount - currentPhase)
local indicator = indicatorFirstPart .. indicatorSecondPart
local phaseValue = phaseValues[currentPhase]
local displayMessage = string.format("phase %d\nSymbol : %s\n%d", currentPhase, indicator, phaseValue)
gg.toast(displayMessage, true)
end
end
local phaseValues = {10, 20, 30, 40, 50}
local symbol1 = "="
local symbol2 = "-"
local displayPhase = createPhaseDisplayer(phaseValues, symbol1, symbol2)
-- Testing all phases with one extra
for i = 1, #phaseValues + 1 do
displayPhase()
end