Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Utility Api "ascoUtilityApi"
- --Seconds to formatted string
- function formatSeconds(sec)
- local base = sec
- local seconds = 0
- local minutes = 0
- local hours = 0
- if(base >= 3600) then
- hours = math.floor(base / 3600)
- base = base % 3600
- end
- if(base >= 60) then
- minutes = math.floor(base / 60)
- base = base % 60
- end
- seconds = base
- local s = ""
- if (hours > 0) then
- s = s .. hours .. " hour"
- if(hours ~= 1) then
- s = s .. "s"
- end
- s = s .. " "
- end
- if (minutes > 0) then
- s = s .. minutes .. " minute"
- if(minutes ~= 1) then
- s = s .. "s"
- end
- s = s .. " "
- end
- if (seconds > 0 or (hours == 0 and minutes == 0 and seconds == 0)) then
- s = s .. seconds .. " second"
- if(seconds ~= 1) then
- s = s .. "s"
- end
- s = s .. " "
- end
- return s
- end
- --Checks if a number is even
- function isEvenNumber(number)
- return (tonumber(number) % 2 == 0)
- end
Advertisement
Add Comment
Please, Sign In to add comment