Hello,
In repair_turret.lua around line 905 you should check for entities not nil before using next. Quick dirty fix hereafter:
if turret_data and turret_data.targets and not next(turret_data.targets) then
return true
end
if turret_data and turret_data.low_priority_queue and not next(turret_data.low_priority_queue) then
return true
end
if turret_data and turret_data.checked_queue and not next(turret_data.checked_queue) then
return true
end