Jump to content

os.date("%M") - 50


Recommended Posts

  • Active Member
local time = os.date("%M")
 
local event_time = time - 60
 
So actually if i use this time - number and number is bigger than os.date("%M") i'm getting a crash and a negative result
 
Example:
 
os.date("%M") = 40
number = 50
 
I'm getting result -10 instead of 10
 
Any solution ? math.floor or something ?
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium

Hmm if I understand you well, your problem is just you sometimes get negative number, and its can not be converted to time format. So if this is the problem, try to use math.abs(number). This will convert all numbers to its absolute value.

The one and only UI programming guideline

Link to comment
Share on other sites

  • 1 year later...
  • Premium

Use math.abs.

  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium

oh lol.

  • Love 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.