Lighted Electric Poles +

by Optera

Adds a copy of every electric pole, including modded ones, with integrated lamp.

Content
6 months ago
0.15 - 1.1
78.1K
Power

b [Fixed] Crash on loading

1 year, 9 months ago

My game is crashing too!


16.526 Error ModManager.cpp:1558: Failed to load mod "LightedPolesPlus": LightedPolesPlus/data-updates.lua:45: attempt to index global 'r' (a nil value)
stack traceback:
LightedPolesPlus/data-updates.lua:45: in function 'GetItemFromRecipeResult'
LightedPolesPlus/data-updates.lua:184: in main chunk


Thanks

1 year, 9 months ago

Same. Had to roll it back to 1.7.1.

1 year, 9 months ago

The fix is to replace the GetItemFromRecipeResult function with:

-- check if recipe contains entry from Items
function GetItemFromRecipeResult(recipe)
if recipe.result and pole_names[recipe.result] then
return recipe.result
end
if recipe.normal and recipe.normal.result and pole_names[recipe.normal.result] then
return recipe.normal.result
end
if recipe.expensive and recipe.expensive.result and pole_names[recipe.expensive.result] then
return recipe.expensive.result
end

if recipe.results then
for , item in pairs(recipe.results) do
if (not item.type or item.type == "item") and (item.name and pole_names[item.name] or pole_names[item[1]]) then
return item.name or item[1]
end
end
end
if recipe.normal and recipe.normal.results then
for
, item in pairs(recipe.normal.results) do
if (not item.type or item.type == "item") and (item.name and pole_names[item.name] or pole_names[item[1]]) then
return item.name or item[1]
end
end
end
if recipe.expensive and recipe.expensive.results then
for _, item in pairs(recipe.expensive.results) do
if (not item.type or item.type == "item") and (item.name and pole_names[item.name] or pole_names[item[1]]) then
return item.name or item[1]
end
end
end

return nil
end

Looks like the new version's code had some copy-pasted if statements from the new code, but didn't change the variable names in the loops to match them.

This thread has been locked.