[Bilka] [0.17.43] _statistics input and output documentation confusing

This subforum contains all the issues which we already resolved.
Post Reply
Qon
Smart Inserter
Smart Inserter
Posts: 1240
Joined: Thu Mar 17, 2016 6:27 am
Contact:

[Bilka] [0.17.43] _statistics input and output documentation confusing

Post by Qon » Wed May 29, 2019 1:57 pm

input means output & output means input
If I ask for outputs of of machines with:

Code: Select all

serpent.block(game.player.force.item_production_statistics.output_counts)
Then I get a nice table listing the input materials consumbed by entities.

input_counts gives me the production output stats.

Left is right and right is wrong.

Last printout here is shown with command used to print it while also showing the stats.
ousu(190529-154603-46).jpg
ousu(190529-154603-46).jpg (565.47 KiB) Viewed 309 times
This flip is the same for other LuaFlowStatistics things I've tested also, like

Code: Select all

game.pollution_statistics
. And it is also swapped for

Code: Select all

get_flow_count
where input = true gives output and vice versa.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9791
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Rseding91 » Wed May 29, 2019 7:16 pm

Thanks for the report however that's working as intended: "input" is positive values (items produce) and output is negative values (things consumed). Except for power which is the other way around.
If you want to get ahold of me I'm almost always on Discord.

Qon
Smart Inserter
Smart Inserter
Posts: 1240
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Qon » Wed May 29, 2019 7:45 pm

When I read the documentation I see this:
get_input_count(string) → uint64 or double
Gets the total input count for a given prototype.
Parameters
string: The prototype name.

get_output_count(string) → uint64 or double
Gets the total output count for a given prototype.
Parameters
string: The prototype name.
It isn't mentioned that input means output and that output means input. And it doesn't make sense just because "input is positive" and "output is negative".
You can just as easily say that "output is positive and input is negative". But if you try to interpret the names with an understanding of the meaning of the English words you get the opposite interpretation of their meaning according to an English dictionary. I don't understand how this is not a bug...
Rseding91 wrote:
Wed May 29, 2019 7:16 pm
Except for power which is the other way around.
Are you just trolling me now or are you actually serious? :roll: :?
So input means output, but only sometimes? :shock:
And it isn't documented!? :cry:

on_flow is clue:
count :: float: The count: positive or negative determines if the value goes in the input or output statistics.
If you interpret positive and negative having the same order as the in/out they are related to as stated after. But it isn't explicitly stated. And it is only sometimes true!

AlFara
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat May 25, 2019 4:14 pm
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by AlFara » Wed May 29, 2019 9:12 pm

I have to admit, it's a bit confusing.
So, if i input a pizza (piece by piece) into my body by inserting it into the mouth, it processes the pizza and outputs the result of the process.

If it's working different here and it's intended, please add, like Qon mentioned, an information to the wiki to prevent confusion, mb like "this means that here because [input reason here]"
Last edited by AlFara on Wed May 29, 2019 9:13 pm, edited 2 times in total.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9791
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Rseding91 » Wed May 29, 2019 9:12 pm

The English names for the storage of the positive and negative values is mostly noise and if possible I would retroactively remove the name and just call it "positive values" and "negative values".

They have no relation to what's actually stored in them past that distinction.

For example: electric networks store values in the opposite groups because it makes the GUI read nicer.
If you want to get ahold of me I'm almost always on Discord.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9791
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Rseding91 » Wed May 29, 2019 9:15 pm

AlFara wrote:
Wed May 29, 2019 9:12 pm
I have to admit, it's a bit confusing.
So, if i input a pizza (piece by piece) into my body by inserting it into the mouth, it processes the pizza and outputs the result of the process.

If it's working different here and it's intended, please add, like Qon mentioned, an information to the wiki to prevent confusion, mb like "this means that here because [input reason here]"
The naming follows "input == add", "output == remove". You "add" by storing positive values to "input" and "remove" by storing negative values to "output". Again, the names are mostly meaningless. I would change them but I consider braking every mod that uses those functions a stupid idea and so the names stay.
If you want to get ahold of me I'm almost always on Discord.

AlFara
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat May 25, 2019 4:14 pm
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by AlFara » Wed May 29, 2019 9:35 pm

i agree, it's better to leave it as it is then.
will you link this topic or edit the description on the nessesary lua site in the near future so it's clear that players regard those values with caution? i think, the place where "Encapsulates statistic data for different parts of the game" would be a good place to add another sentence for clarification while keeping the method descriptions short and solid^^

-edit-
@bilka's post below: thank you very much :)
Last edited by AlFara on Thu May 30, 2019 4:05 pm, edited 1 time in total.

Bilka
Factorio Staff
Factorio Staff
Posts: 2144
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Bilka » Thu May 30, 2019 8:09 am

I took the liberty to see this as a documentation bug, and fixed the documentation for the next version. In short, the easiest way to find out what input and what output is, is to look at the GUI for the statistics. Input is on the left, output on the right. I documented it as such, including some examples.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Qon
Smart Inserter
Smart Inserter
Posts: 1240
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [0.17.43] _statistics input and output are swapped

Post by Qon » Thu May 30, 2019 11:08 am

Rseding91 wrote:
Wed May 29, 2019 9:15 pm
The naming follows "input == add", "output == remove". You "add" by storing positive values to "input" and "remove" by storing negative values to "output". Again, the names are mostly meaningless. I would change them but I consider braking every mod that uses those functions a stupid idea and so the names stay.
Well, at least they aren't named with the intention of causing maximal Qonfusion :D
I can appreciate both good names that are well documented and not getting my mods broken so I understand a bit of reluctance to change it.
Bilka wrote:
Thu May 30, 2019 8:09 am
I took the liberty to see this as a documentation bug, and fixed the documentation for the next version. In short, the easiest way to find out what input and what output is, is to look at the GUI for the statistics. Input is on the left, output on the right. I documented it as such, including some examples.
Thanks :)
Is this true for electric networks also, or did I misunderstand Rseding91?
Rseding91 wrote:
Wed May 29, 2019 7:16 pm
Thanks for the report however that's working as intended: "input" is positive values (items produce) and output is negative values (things consumed). Except for power which is the other way around.
So is "input = negative, on the left" or is "input = negative, on the right". Or maybe it is "input = positive, on the right" because production is on the right for electric networks (my current guess)?

And why is production on the right in the GUI for electric networks when it is on the left for everything else?

Also, am I correct to assume that this documentation fix will appear at https://lua-api.factorio.com/latest/Lua ... stics.html ? Are there other places where this will be documented, like `game.pollution_statistics` (which links to LuaFlowStatistics) if different flow stat usage has it "the other way around" (depending on what that means)?

Bilka
Factorio Staff
Factorio Staff
Posts: 2144
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [Bilka] [0.17.43] _statistics input and output documentation confusing

Post by Bilka » Thu May 30, 2019 11:20 am

Qon wrote:
Thu May 30, 2019 11:08 am
Is this true for electric networks also, or did I misunderstand Rseding91?
It's also true there, open it up in-game and you see that the energy consumption is on the left (and thus input), which leads to your confusion.
Qon wrote:
Thu May 30, 2019 11:08 am
And why is production on the right in the GUI for electric networks when it is on the left for everything else?

Also, am I correct to assume that this documentation fix will appear at https://lua-api.factorio.com/latest/Lua ... stics.html ?
I think the electric network GUI is different because it is "more useful" to have the consumption on the left, the "primary" side (we read left to right). There is much more information to be found in the >10 machines that are consuming compared to the max 4 that are producing.

And yes.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users