Page 1 of 1

Factorio Standard Library Project (link)

Posted: Sat Sep 17, 2016 11:50 am
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.

Re: Factorio Standard Library Project (link)

Posted: Sat Sep 17, 2016 1:42 pm
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.

Re: Factorio Standard Library Project (link)

Posted: Thu Sep 22, 2016 9:31 pm
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.

Re: Factorio Standard Library Project (link)

Posted: Sat Sep 24, 2016 10:59 pm
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. :)

Re: Factorio Standard Library Project (link)

Posted: Thu May 18, 2017 11:03 am
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.

Re: Factorio Standard Library Project (link)

Posted: Thu May 18, 2017 11:28 am
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

Re: Factorio Standard Library Project (link)

Posted: Thu May 18, 2017 4:43 pm
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

Re: Factorio Standard Library Project (link)

Posted: Thu May 18, 2017 11:19 pm
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)

Re: Factorio Standard Library Project (link)

Posted: Fri May 19, 2017 12:25 am
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.