/c for _, surface in pairs(game.surfaces) do for _, e in pairs(surface.find_entities_filtered{ force = "enemy", type = "unit" }) do if e.name:find("biter") then e.destroy() end end end
This command works fine when run in the in-game console, but returns the following error when run in your console:
1 : local player = game.players[1]
2>: /c for _, surface in pairs(game.surfaces) do for _, e in pairs(surface.find_entities_filtered{ force = "enemy", type = "unit" }) do if e.name:find("biter") then e.destroy() end end end
Error in line 2: attempt to perform arithmetic on field '?' (a userdata value)
stack traceback:
Error in line:2: in main chunk