How to get longer int to not lose os.time() seconds?

How to get longer int to not lose os.time() seconds?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

How to get longer int to not lose os.time() seconds?

Post by zwzsg »

So, I noticed os.time() doesnt get incremented every second.

Then I realised that's because it's such a big number its floating point representation make it drop the second.

<zwzsg> How big can Lua integers be before they start to lose some digits?
<[LCC]jK> 2^24

For exemple, now os.time() is 1264300032, why is about a hundred time bigger than 16777216.

Thanksfully, using os.date() can return a formatted string with the exact second count.
Post Reply

Return to “Lua Scripts”