Get date

Place to get help with not working mods / modding interface.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Get date

Post by darkfrei »

Hi all!

I don't know how to get some unikal ID of the game. How to get the date of today or date of game starting?
Rseding91
Factorio Staff
Factorio Staff
Posts: 15998
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Get date

Post by Rseding91 »

There is no ID of a game and no way to get any kind of date/time in mods.

Additionally there's nothing unique about any save file. You could have 2 save files generated at 2 completely different dates that end up binary identical if you happen to save at the same tick.
If you want to get ahold of me I'm almost always on Discord.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Get date

Post by darkfrei »

Rseding91 wrote:There is no ID of a game and no way to get any kind of date/time in mods.

Additionally there's nothing unique about any save file. You could have 2 save files generated at 2 completely different dates that end up binary identical if you happen to save at the same tick.
And when I want it use only like:

Code: Select all

game.write_file(os.date('%Y%m%d') ..".txt", data)
Then, it must be every day a new log-file, not overwriting an old one.
Post Reply

Return to “Modding help”