Jump to content

Question


scratcher911

Recommended Posts

  • Scripting Moderators
function getGameTime ( ) 
    local time = getRealTime ( ) 
    local hours = time.hour 
    local minutes = time.minute 
     
    if hours < 10 then 
        hours = "0" .. hours 
    end 
     
    return hours .. ":" .. minutes 
end 
  
-- outputChatBox ( getGameTime ( ) ) 

Link to comment
function getGameTime ( ) 
    local time = getRealTime ( ) 
    local hours = time.hour 
    local minutes = time.minute 
     
    if hours < 10 then 
        hours = "0" .. hours 
    end 
     
    return hours .. ":" .. minutes 
end 
  
-- outputChatBox ( getGameTime ( ) ) 

There is no need for that:

string.format( '%02d', getRealTime().hour ) 
  
--Output: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13 and so on. 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...