O'Reilly logo

Learn Lua for iOS Game Development by Jayant Varma

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter     3

File Operations

When creating an app or a game, you need file I/O (input/output). You may not be working with a database, but there will always be the need to save something back to the disk; it could be the levels, the high score, a character the player might have unlocked, or some information regarding in-app purchases.

So, let’s first look at what we have available in terms of functions that offer file operation functionality. Lua has two sets of functions for file operations, one called implicit and the other explicit. The difference between the two is that implicit functions work on the default file as provided by the io namespace, whereas explicit functions work with a file handle provided from a previous operation, such ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required