Page 1 of 1

[0.16.51] API documentation for Product incorrect

Posted: Mon Oct 01, 2018 5:40 pm
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.

Re: [0.16.51] API documentation for Product incorrect

Posted: Mon Oct 01, 2018 8:53 pm
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.

Re: [0.16.51] API documentation for Product incorrect

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

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

Re: [0.16.51] API documentation for Product incorrect

Posted: Tue Oct 02, 2018 5:14 pm
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.