Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Types of values


Lua is a dynamically typed language. There is no defined variable type in the language. This allows each value to carry its own type.

As you have noticed, values can be stored in variables. They can be manipulated to give a value of any type. This also allows you to pass arguments to other functions and have them returned as results.

The basic types of values that you'll deal with are as follows:

  • Nil: This is the only type whose value is nil. Any uninitialized variable has nil as its value. Like global variables, it is nil by default and can be assigned nil to delete it.

  • Boolean: This type has two values: false and true. You will notice that conditional expressions consider false and nil as false and anything else as true.

  • Numbers: These represent real (double-precision, floating-point) numbers.

  • String: This is a sequence of characters. 8-bit characters and embedded zeroes are allowed.

  • Tables: These are data structures in Lua. They are implemented by an associative array, which...