[2.0] LuaRecipe missing quality

Place to get help with not working mods / modding interface.
sirhc
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 30, 2024 6:36 am
Contact:

[2.0] LuaRecipe missing quality

Post by sirhc »

I've spent some time looking over the documentation, the forum and running commands but I can't seem to work out the quality of an assembly machine's recipe.

I'm aware result_quality will tell me the expected quality of a resource being created, but it feels like .get_recipe() is missing .quality in the LuaRecipe class.

Is anyone able to provide guidance?
User avatar
LCStark
Fast Inserter
Fast Inserter
Posts: 205
Joined: Thu Jan 28, 2021 5:04 pm
Contact:

Re: [2.0] LuaRecipe missing quality

Post by LCStark »

`LuaEntity` defines `get_recipe()` as `get_recipe() → LuaRecipe?, LuaQualityPrototype?`, so it returns two values separately - the recipe and the quality. Something like this should be what you're looking for:

Code: Select all

local assembler = [...]
[...]
local recipe, quality = assembler.get_recipe()
sirhc
Manual Inserter
Manual Inserter
Posts: 4
Joined: Wed Oct 30, 2024 6:36 am
Contact:

Re: [2.0] LuaRecipe missing quality

Post by sirhc »

Nearly 2 weeks of trying to fix this issue, and it was solely because I didn't understand lua behaviour.

I greatly appreciate your kind and well-put-together response.
Post Reply

Return to “Modding help”