Im getting a non-recoverable error,
Error while running event windturbines::on_nth_tick(61)
windturbines/control.lua:151: attempt to index field '?' (a nil value)
stack traceback:
windturbines/control.lua:151: in function 'destroy_turbine'
windturbines/control.lua:103: in function <windturbines/control.lua:90>
im running latest version as far as i can tell,
from examaning the code and adding some log entries in on_nth_tick(61, function(event) and else where
it appears that it runs through the loop a few times and then something destroys a turbine premeturely removing it from the global.turbines table
then
if global.turbines[unit_number].turbine then
global.turbines[unit_number].turbine.destroy()
end
tries to destroy it but global.turbines[unit_number] doesnt exist
i can work around the error, by adding "not(global.turbines[unit_number] == nil) and" for each destroy, but dont know whats removing it from the table
function destroy_turbine(unit_number, died)
if not global.turbines[unit_number] then return end
if died then
if global.turbines[unit_number].base and global.turbines[unit_number].base.valid then
global.turbines[unit_number].base.die(global.turbines[unit_number].base.force)
end
elseif global.turbines[unit_number].base then
global.turbines[unit_number].base.destroy()
end
if not(global.turbines[unit_number] == nil) and global.turbines[unit_number].turbine then
global.turbines[unit_number].turbine.destroy()
end
if not(global.turbines[unit_number] == nil) and global.turbines[unit_number].shadow then
global.turbines[unit_number].shadow.destroy()
end
if not(global.turbines[unit_number] == nil) and global.turbines[unit_number].collision_box then
global.turbines[unit_number].collision_box.destroy()
end
global.turbines[unit_number]=nil
end