Was playing a mod (Mobile Factory) which directly inserts pseudo-items into a "printer" entity from a virtual storage (control table with name and amount of items).
If the storage has a fractional value, when the fraction is inserted (inventory.insert({name = "foo", count = amnt}), the error returned is "Item stack count has to be a positive number". There was an immediate <= 0 check right before the insert, so I was thoroughly confused. It turned out the virtual storage had .5 (well .500000000... 5), and this .5 caused the error. Either insert accepts positive numbers >= 1 (untested), or it doesn't accept decimals at all. If the latter, the error would be more accurate if changed to describe needing a positive integer, but if the former, a positive number >= 1.
[0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
[0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
I have mods! I guess!
Link
Link
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
Thanks for the report. The error message is correct: It's impossible to have < 1 of an item. The way items work is you have integer amounts of them and then a given item has a durability value on it but you still have 1 complete item just with 50% durability.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
...the error message states "Item stack count has to be a positive number". 0.5 is a positive number. I understand why items only should be in integer amounts, but a "number"Rseding91 wrote: Wed Feb 26, 2020 12:26 pm Thanks for the report. The error message is correct: It's impossible to have < 1 of an item. The way items work is you have integer amounts of them and then a given item has a durability value on it but you still have 1 complete item just with 50% durability.
in the non-crazy-pants-on-head-world
is a real number, we have words for these things. Throwing an error saying .5 is not greater than 0 is just not right. (I thought I saw a mod that took .7 ore to produce 1-plate-producing dust... wish I could find it)To check a recipe, I threw in a mod that transport-belts should need .5 plates. I get a similarly incorrect message:
.5 is not 0. That one isn't even an opinion. That math is wrong.Mods to disable:Failed to load mods: Error while loading recipe prototype "transport-belt" (recipe): Difficulty normal: Item ingredient can't have count of 0.
I have mods! I guess!
Link
Link
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
https://wiki.factorio.com/Types/ItemIngredientPrototype: amount is an integer. (int)(0.5) = 0..5 is not 0. That one isn't even an opinion. That math is wrong.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
Then use the word integer in the message. What's confusing about this.Bilka wrote: Wed Feb 26, 2020 1:08 pmhttps://wiki.factorio.com/Types/ItemIngredientPrototype: amount is an integer. (int)(0.5) = 0.5 is not 0. That one isn't even an opinion. That math is wrong.
I have mods! I guess!
Link
Link
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
What would the message be for the ItemIngredientPrototype?Honktown wrote: Wed Feb 26, 2020 1:09 pm Then use the word integer in the message. What's confusing about this.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
No idea, you're the one who's confused about integers not accepting floating point values. So, you'd have to explain why you're confused and (seemingly) nobody else is having enough issue to make a bug report about it?Honktown wrote: Wed Feb 26, 2020 1:09 pmThen use the word integer in the message. What's confusing about this.Bilka wrote: Wed Feb 26, 2020 1:08 pmhttps://wiki.factorio.com/Types/ItemIngredientPrototype: amount is an integer. (int)(0.5) = 0.5 is not 0. That one isn't even an opinion. That math is wrong.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.18.8] inventory.insert() has inaccurate error message for 0 < count < 1
Same thing: Amount/Count "needs to be a positive integer." Tells me exactly what's wrong if I give it .5 and have an error. Saying "ingredient count is 0" might make sense to you when you're staring at the C++ side, but that's now what the user gets to see. Saying "Value is not a positive number" is dumb because .5 is a positive number.
A number is not always an integer, no matter what you think everyone else should think. 0.5 is a positive number and it is not zero. If needed to be an integer, then instead of flooring the float period, just say it can't be a decimal. I'm using code in a way that wasn't expected, and the error message is inaccurate and leads any reader to the wrong conclusion. The error message writer did not expect code to be used in this way, and thought it made sense at the time, but it is not accurate to how one can use the function.Rseding91 wrote: Wed Feb 26, 2020 2:42 pmNo idea, you're the one who's confused about integers not accepting floating point values. So, you'd have to explain why you're confused and (seemingly) nobody else is having enough issue to make a bug report about it?Honktown wrote: Wed Feb 26, 2020 1:09 pmThen use the word integer in the message. What's confusing about this.Bilka wrote: Wed Feb 26, 2020 1:08 pmhttps://wiki.factorio.com/Types/ItemIngredientPrototype: amount is an integer. (int)(0.5) = 0.5 is not 0. That one isn't even an opinion. That math is wrong.
I have mods! I guess!
Link
Link