I am trying to update my favorite mod from Factorio Ver. 0.10 but I have hit a bit of a snag.
I think the code is right but I keep getting an error when I try to run it.
The game says that I have:
Failed to load mods: __Ztech__/data.lua:48: <eof> expected near 'end'
I am guess that this is an syntax error of some kind. I have 6 ifs for 6 ends so I am wondering if there is something I have missed?
Code: Select all
function modIngredients(ingredients)
local multipliers = { 1, 2, 4, 8, 16 }
local total = #ingredients
for i = 1, total do
local pack = ingredients[i][1]
local count = ingredients[i][2]
if (pack == "science-pack-1")
then
ingredients[i][2] = count*multipliers[total]
elseif (pack == "science-pack-2")
then
if ((total-1) < 1) then
--ingredients[i][2] = 1000
else
ingredients[i][2] = count*multipliers[total-1]
end
elseif (pack == "science-pack-3")
then
if ((total-2) < 1) then
--ingredients[i][2] = 1000
else
ingredients[i][2] = count*multipliers[total-2]
end
elseif (pack == "production-science-pack")
then
if ((total-3) < 1) then
--ingredients[i][2] = 1000
else
ingredients[i][2] = count*multipliers[total-3]
end
elseif (pack == "high-tech-science-pack")
then
if ((total-4)<1) then
--ingredients[i][2] = 1000
else
ingredients[i][2] = count*multipliers[total-4]
end
elseif (pack == "space-science-pack")
then
if ((toatl-5)<1) then
--ingredients [i][2] = 1000
else
ingredients[i][2] = count*multipliers[total-5]
end
end
end
end
end
for k,v in pairs(data.raw.technology) do
modIngredients(v.unit.ingredients)
end