Fix for__pycoalprocessing__/prototypes/functions/functions.lua:383: attempt to index field 'expensive' (a boolean value)
Posted: Mon Oct 31, 2022 4:51 pm
I'm working on compatibility between your mods and mine. My mod generates a whole host of recipes that have expensive and normal modes. The handling of these modes in the prototypes.functions.functions.lua file is wrong due to a faulty assumption.
The `expensive` and `normal` fields of recipes can be either nil, false, or Recipedata. The function overrides.ingredient_replace function, lines 377 to 384:
In both the inner if statements the assumption is made that ~= nil implies that the field is a Recipedata, but it can also be `false`. It can be set to false to disable said recipe in a mode.
The solution here is to remove the `~= nil` part of the if statement. I have made that patch in a local copy of the mod, and that solves the issue.
If there is someplace I can send a patch or a pull request I'd be happy to, but I can't find anything of the sort.
The `expensive` and `normal` fields of recipes can be either nil, false, or Recipedata. The function overrides.ingredient_replace function, lines 377 to 384:
Code: Select all
elseif recipe.normal or recipe.expensive then
--log(serpent.block(recipe))
if recipe.normal ~= nil then
--log("is check good")
ningredients = recipe.normal.ingredients
end
if recipe.expensive ~= nil then eingredients = recipe.expensive.ingredients end
The solution here is to remove the `~= nil` part of the if statement. I have made that patch in a local copy of the mod, and that solves the issue.
If there is someplace I can send a patch or a pull request I'd be happy to, but I can't find anything of the sort.