Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.