Time for action – Saving the list
In order to save the list, we will serialize it and save the result in a file. This indeed is certainly not the best way to do things but in our case, it will be enough.
public static function save() { php.io.File.putContent("zookeeper.data", haxe.Serializer.run(animals)); }
Very simple, isn't it? We are simply serializing the animals list and dumping the result directly in the zookeeper.data
file.