Always verify an entity exists:
if e ~= nil then gol.attackAt(e) end
Pass the entire entity table, not individual fields:
Correct:
gol.attackAt(e)
Incorrect:
gol.attackAt(e.x)