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

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 445
Joined: Thu Dec 21, 2017 8:02 am
Contact:

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

Post 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
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 323
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

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

Post 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.
User avatar
Quezler
Fast Inserter
Fast Inserter
Posts: 201
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

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

Post by Quezler »

isn't the difference generally that one is integer and the other one decimal?
Osmo
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

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

Post 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
User avatar
PennyJim
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Jan 18, 2023 3:49 am
Contact:

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

Post 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.
Post Reply

Return to “Resolved Requests”