Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

how to format a number into hh:mm:ss in lua

function convert_to_time(tenths)
  local hh = (tenths // (60 * 60 * 10)) % 24
  local mm = (tenths // (60 * 10)) % 60
  local ss = (tenths // 10) % 60
  local t = tenths % 10

  return string.format("%02d:%02d:%02d.%01d", hh, mm, ss, t)
end
Source by codereview.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #format #number #lua
ADD COMMENT
Topic
Name
9+8 =