21 lines
572 B
Lua
21 lines
572 B
Lua
---Formats the game time in seconds to MM:SS.
|
|
---@param gameTime number The game time in seconds.
|
|
---@return string
|
|
function FormatTime(gameTime)
|
|
local minutes = Dirty_Floor(gameTime / 60)
|
|
local minutesText = tostring(minutes)
|
|
|
|
if tonumber(minutes) < 10 then
|
|
minutesText = "0" .. minutesText
|
|
end
|
|
|
|
local seconds = Dirty_Floor(gameTime - (minutes * 60))
|
|
local secondsText = tostring(seconds)
|
|
|
|
if tonumber(seconds) < 10 then
|
|
secondsText = "0" .. secondsText
|
|
end
|
|
|
|
return string.format("%s:%s", minutesText, secondsText)
|
|
end
|