You are previewing Learn Lua for iOS Game Development.
O'Reilly logo
Learn Lua for iOS Game Development

Book Description

So you have a great game idea for iPhone or iPad, but Objective-C just seems a bit daunting. What are your alternatives? The App Store is very picky about languages, but there is hope: Lua is a versatile, lightweight, fast, and easy to learn language that you can use to build your iOS games and get them accepted into the App Store.

Learn Lua for iOS Game Development walks you through the Lua basics, then shows you how to create games using the top Lua frameworks like Corona SDK, Gideros, Moai, and even how to create games on the iPad (not just for the iPad) with Codea.

You aren't tied to Xcode and Objective-C -- you can create all sorts of amazing games with Lua. But if you already have an existing iOS game, you'll also learn how to integrate Lua to extend the game. If you're an aspiring or current iOS developer, you need to know Lua, and Learn Lua for iOS Game Development will give you just what you need to do that.

What you'll learn

  • Lua basics for iOS

  • How to choose a Lua framework depending on your needs

  • How to use Corona, Gideros, Moai, and more

  • How to use Lua to create a game faster and easier than with Objective-C

  • How to use Lua libraries, wrappers, and third party tools

Who this book is for

Beginning iOS developers who find Objective-C difficult but HTML5-based tools too limiting; more advanced iOS developers who want to integrate and open their apps to extension via Lua scripting.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewers
  7. Acknowledgments
  8. Chapter 1: Introduction to Lua1
    1. What Is Lua?
    2. The History of Lua
    3. Lua Timeline
    4. Starting with Lua
    5. Setting Up Lua
    6. Features of Lua
    7. Lua Operators
    8. Summary
  9. Chapter 2: Lua Libraries
    1. Basic Functions
    2. System Libraries
    3. Tables: A Quick Overview
    4. Functions: An Advanced Look
    5. Summary
  10. Chapter 3: File Operations
    1. Implicit Functions
    2. Explicit Functions
    3. Uses of File I/O in Gaming
    4. Saving a Variable
    5. Grabbing the Data
    6. Saving Data to a Variable
    7. Writing Data to the File
    8. Saving a Table
    9. Dynamic Variables
    10. Summary
  11. Chapter 4: Math with Lua
    1. Introduction to Math in Lua
    2. Practical Uses of Math in Gaming
    3. Boolean Math
    4. Summary
  12. Chapter 5: Strings
    1. What Is a String?
    2. Patterns
    3. Using the String Functions
    4. Level Management
    5. Summary
  13. Chapter 6: Threading
    1. Coroutines
    2. Working with Tables
    3. Object-Oriented Lua
    4. But What’s the Object?
    5. Summary
  14. Chapter 7: Tips and Tricks
    1. Generic Lua Functions
    2. Collisions
    3. Other Generic Functions
    4. Parameter Handling
    5. Vector 2D
    6. Summary
  15. Chapter 8: Corona SDK
    1. Setting Up Corona SDK
    2. How Corona SDK Works
    3. Hello World for Corona SDK
    4. Beyond Hello World: Creating a Rectangle on the Screen
    5. Timing Is Everything
    6. Animating Using enterFrame
    7. Creating Sound
    8. Working with Videos
    9. Creating an Elevator
    10. The Internet Browser
    11. Nothing Lasts Forever
    12. Enterprise Edition
    13. Summary
  16. Chapter 9: Gideros Studio
    1. License
    2. Installing Gideros Studio
    3. Architecture
    4. The Gideros Engine
    5. Plug-Ins
    6. Summary
  17. Chapter 10: Moai
    1. What Is Moai?
    2. Obtaining Moai
    3. The Moai SDK
    4. Hello Moai
    5. Displaying Text
    6. Drawing Vector Primitives
    7. Drawing Images
    8. Animation
    9. Tile Decks
    10. Threading
    11. Groups
    12. Handling Input
    13. Sound
    14. Displaying a Dialog
    15. Displaying Video
    16. Device Orientation
    17. Notifications
    18. Networking
    19. Using JSON
    20. Using Base64
    21. Compressing Data
    22. Physics
    23. Moai Cloud
    24. Summary
  18. Chapter 11: LÖVE
    1. The Architecture
    2. Installing LÖVE
    3. Running LÖVE
    4. The Callback Functions
    5. LÖVE Namespaces
    6. The Graphics Module
    7. Application Settings – conf.lua
    8. Creating Effects
    9. Physics
    10. Displaying Text
    11. Shaders
    12. Making Sound
    13. Sample Game Code
    14. Summary
  19. Chapter 12: Codea
    1. Getting Codea
    2. Codea Architecture
    3. Hello World
    4. Parameters
    5. Drawing with Codea
    6. Displaying Images
    7. Recording Video
    8. Touch
    9. Making Sound
    10. iOS Hardware
    11. Downloading Data
    12. Displaying Web Pages
    13. Physics
    14. Vector Math
    15. Summary
  20. Chapter 13: Libraries
    1. Particle Candy
    2. Text Candy
    3. Widget Candy
    4. Corona AutoLAN
    5. Corona Profiler
    6. Director
    7. Lime
    8. RapaNui
    9. Gideros Illustrator (SVG Library)
    10. TNT Particles Library
    11. Busted
    12. Moses
    13. Allen
    14. BhWax
    15. Summary
  21. Chapter 14: Third-Party Applications
    1. IDEs
    2. Text Editors
    3. Snippets Collectors
    4. Versioning
    5. Bitmap Editors
    6. Sprite Animation and Level Creation Tools
    7. Sound Tools
    8. Summary
  22. Chapter 15: Sample Source Code
    1. Graphics
    2. Setting Up the Environment
    3. Making the Chopper Fly
    4. Using the Accelerometer
    5. Moving the Helicopter
    6. Making Sound
    7. Shooting Bullets
    8. Moving the Bullets
    9. Spawning Enemies
    10. Moving the Scenery Objects
    11. Losing a Life
    12. Let There Be Some Color
    13. Displaying Information
    14. Game Over; Play Again?
    15. Collisions
    16. Putting It All Together
    17. Summary
  23. Index