[0.16.51] API documentation for Product incorrect

Bugs that are actually features.
Post Reply
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 181
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

[0.16.51] API documentation for Product incorrect

Post by moon69 »

The documentation for API-Concepts-Product doesn't appear to agree with examples from factorio-data.

Specifically (my emphasis)...
probability :: double (optional): A value in range [0, 1]. Item or fluid is only given with this probability; otherwise no product is produced.
Has no effect when amount is specified.
However, looking at 'uranium-processing' recipe results on factorio-data, you can see that amount and probability can co-exist...

Code: Select all

      {
        name = "uranium-235",
        probability = 0.007,
        amount = 1
      },
Cheers.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.16.51] API documentation for Product incorrect

Post by posila »

Hello, thanks for the report.

Lua API documentation is only about runtime API, and doesn't document prototype definitions. The API does expose most of the prototype definitions in some form, but they are in a form that has been processed by the game. So, the prototype definition allows probability and amount to coexits, but when you use the API to introspect results of uranium-processing recipe, you'll get table

Code: Select all

     {
        name = "uranium-235",
        probability = 0.007,
        amount_min = 1,
        amount_max = 1,
      },
We don't have any automated generation of prototype definitions, Bilka is trying to document it on wiki https://wiki.factorio.com/Prototype_definitions, but we keep changing it all the time

TL;DR: The documentation is not about the file you linked.

User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 181
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: [0.16.51] API documentation for Product incorrect

Post by moon69 »

Thanks posila - understood!

I'm parsing a dump of data.raw so not getting the processed API version of the data.

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

Re: [0.16.51] API documentation for Product incorrect

Post by Rseding91 »

moon69 wrote:
Tue Oct 02, 2018 12:19 pm
Thanks posila - understood!

I'm parsing a dump of data.raw so not getting the processed API version of the data.
As expected :P That's why the API version is the API version and data.raw is the 'raw' version.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Not a bug”