Hello, I would like to list here some of the things that can cause crashes. I found two, maybe other modders will report some.
* Too much work between two frames. Not just keeping the CPU busy, this does not make civ5 crash. But things like editing many unit, many hexes, etc. A good example is a loop that destroy 1000 units through Kill(true), it always make civ5 crash. The maximum number of things you can do seems to be related to the user's CPU. The solution is to split your work across many frames by subscribing to ContextPtr:SetUpdate. In IGE, you can look at the LuaEvents.IGE_Schedule event if you're interested.
* Manipulating savegames (delete, load, save) through the filename only. It always causes a crash on macs, it's random on some PC and never happens on other ones (depending on OS version?). Use the full path instead of the file name. In IGE, you can look at the DeleteFiles function if you're interested (scan all files to get the fullpath from the filename). It also deletes all files with that same filename, which can be interesting in some cases.
* Too much work between two frames. Not just keeping the CPU busy, this does not make civ5 crash. But things like editing many unit, many hexes, etc. A good example is a loop that destroy 1000 units through Kill(true), it always make civ5 crash. The maximum number of things you can do seems to be related to the user's CPU. The solution is to split your work across many frames by subscribing to ContextPtr:SetUpdate. In IGE, you can look at the LuaEvents.IGE_Schedule event if you're interested.
* Manipulating savegames (delete, load, save) through the filename only. It always causes a crash on macs, it's random on some PC and never happens on other ones (depending on OS version?). Use the full path instead of the file name. In IGE, you can look at the DeleteFiles function if you're interested (scan all files to get the fullpath from the filename). It also deletes all files with that same filename, which can be interesting in some cases.