Factorio Standard Library Project (link)

Place to get help with not working mods / modding interface.
Post Reply
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Factorio Standard Library Project (link)

Post by ssilk »

I found this very useful and think advertising it a bit more makes sense:
viewtopic.php?f=69&t=23181 Factorio Standard Library Project

I hope it is still maintained, cause the thread looks orphaned.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by aubergine18 »

It's still maintained to some extent and quite a lot of mods use StdLib or bits of code from it. One of it's best features, IMO, is the ability to represent tiles and chunks as single primitive values (rather than arrays or tables) - makes lookup tables and comparisons much faster. It also has methods to associate tiles, chunks and entities with custom metadata.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by Afforess »

ssilk wrote:I found this very useful and think advertising it a bit more makes sense:
viewtopic.php?f=69&t=23181 Factorio Standard Library Project

I hope it is still maintained, cause the thread looks orphaned.
Yes, it is absolutely still maintained. The thread location is not in a great place, so if you can think of a more appropriate location, please, go ahead and move it.

Also, you may want to link to the lua-docs for the Factorio Standard Library Project, which is located here: http://afforess.github.io/Factorio-Stdlib/
aubergine18 wrote:It's still maintained to some extent and quite a lot of mods use StdLib or bits of code from it. One of it's best features, IMO, is the ability to represent tiles and chunks as single primitive values (rather than arrays or tables) - makes lookup tables and comparisons much faster. It also has methods to associate tiles, chunks and entities with custom metadata.
Yea! Deterministic IDs are important, and often are *badly* re-implemented by many mods.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by ssilk »

Afforess wrote: Yes, it is absolutely still maintained. The thread location is not in a great place, so if you can think of a more appropriate location, please, go ahead and move it.
Hm. It's placed in the right board: Tools. There is currently no better place for that. If someone looks for this stuff he will find it.
That's why I posted this article in mods-help and made it sticky. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
OsmeOxys
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Aug 27, 2015 12:15 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by OsmeOxys »

So, Im having a bit of difficulty figuring out the logger function. When its run, no file nor folder is made. My code is simply:

Code: Select all

require 'stdlib/log/logger'
LOGGER = Logger.new('testy', 'test', true)
LOGGER.log("testytest")
Not sure what Im doing wrong here.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by Choumiko »

In what file are you using it? data.lua or control.lua?

It won't work in data.lua (or other data stage files), since it relies on the game variable being available.
In control.lua (or any other file required via control.lua) it Logger.log() has to be called from within a function that get's triggered by a event (i think)

for data stage logging there's the Factorio version of log("testytest") which writes to factorio-current.log
Edit:
added an issue https://github.com/Afforess/Factorio-Stdlib/issues/81

User avatar
OsmeOxys
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Aug 27, 2015 12:15 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by OsmeOxys »

That was in control.lua that it failed in. I would love data.lua ability though. DOnt think data has the ability to write though

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Factorio Standard Library Project (link)

Post by Nexela »

Until game is present (after init or load) all logs are queued up. New logs won't be printed out until the first logger event after game is available. (this is true regardless of the debug setting)

User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: Factorio Standard Library Project (link)

Post by Afforess »

OsmeOxys wrote:That was in control.lua that it failed in. I would love data.lua ability though. DOnt think data has the ability to write though
It does (albeit to factorio-current.log and not a custom location).
Nexela wrote:Until game is present (after init or load) all logs are queued up. New logs won't be printed out until the first logger event after game is available. (this is true regardless of the debug setting)
An enhancement to stdlib is actively being proposed to allow it to also log when loaded in data.lua.

Post Reply

Return to “Modding help”