Page 1 of 1

Inconsistent use of "count" and "amount" in modding api

Posted: Fri Dec 13, 2024 7:50 pm
by ownlyme
i posted a topic on the modding interface requests, noting that the use of count and amount should be consistent across prototype and runtime stage.
why was this deleted?
maybe at least send me a pm when you delete my topics

edit:
thanks for moving the topic, but it's more of an api change request, maybe for the next major release you could make the api a bit more consistent.
another thing to make more consistent is the .name field, which returns a prototype on some stuff since recently (been modding 0.16-0.18 and .name was never anything else than a string iirc)
if it's a prototype, like an item, the field could be named .item for example

Re: Inconsistent use of "count" and "amount" in modding api

Posted: Wed May 28, 2025 10:55 am
by Therenas
Hi, thanks for the request. I get the frustration of there being naming inconsistencies, but there are a lot of these all over, and in many cases we don't feel it's worth breaking mods for renames like this.

Re: Inconsistent use of "count" and "amount" in modding api

Posted: Wed May 28, 2025 11:15 am
by Quezler
isn't the difference generally that one is integer and the other one decimal?

Re: Inconsistent use of "count" and "amount" in modding api

Posted: Thu May 29, 2025 6:48 pm
by Osmo
Quezler wrote: Wed May 28, 2025 11:15 am isn't the difference generally that one is integer and the other one decimal?
Not always. Fluids are usually amount, but items are inconsistent. The most prominent example is that minable and placeable_by uses count, while recipe ingredients and products uses amount.
https://lua-api.factorio.com/latest/typ ... html#count
https://lua-api.factorio.com/latest/typ ... html#count

https://lua-api.factorio.com/latest/typ ... tml#amount
https://lua-api.factorio.com/latest/typ ... tml#amount

Re: Inconsistent use of "count" and "amount" in modding api

Posted: Thu May 29, 2025 8:42 pm
by PennyJim
Osmo wrote: Thu May 29, 2025 6:48 pm Not always. Fluids are usually amount, but items are inconsistent. The most prominent example is that minable and placeable_by uses count, while recipe ingredients and products uses amount.
Hence "generally". I see that specific example more as fluid can take decimals and the Ingredient and ProductPrototype sharing the keyword matters more than the discontinuity of items using amount.