civ2units
Emperor
That's "natural" behaviour, that Captain Nemo described in the thread I linked, if it wasn't clear. I didn't put it in a regular quote box for some reason. It doesn't have anything to do with Lua. Of course, you could use Lua to check if a ship is adjacent to a fortress, and generate cannon balls only in that case, but the AI might choose to use all of them to attack the same ship (since the AI can launch missiles from any location, not just the city they are actually in).
Oh, ok. I thought it was something realized with LUA and didn't know that this is still possible with the basic game mechanics. I never used missile type units but it seems that it is worth to deal with them, at least for the AWI scenario.