Maybe as help for others... arrays start with 1 and not with 0 in lua

Code: Select all
if global.playerstartlocations[1] then
unit.set_command{type = defines.command.attack_area, global.playerstartlocations[1], radius = 1500}
else
game.player[1].print("global.playerstartlocations[1] is null")
end
Code: Select all
table.insert(global.playerstartlocations, nearest_playerport)