The fact that triangle_write_nodes() needs to be called before triangle_write_elements() was quite surprising to me.
It would be nice if this (and other dependencies, if they exist) were documented. Maybe it would even be possible to have the functions check for this automatically and fail if called in the wrong order?