- Corona SDK Mobile Game Development:Beginner's Guide
- Michelle M. Fernandez
- 231字
- 2021-08-06 19:59:45
Types of values
Lua is a dynamically typed language. There is no defined type in the language. Each value carries 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 return as results.
The basic types of values that you'll deal with are the following:
nil
—It is the only type whose value isnil
. Any uninitialized variable hasnil
as its value. Like global variables, it isnil
by default and can be assignednil
to delete it.Boolean
—TheBoolean
type has two values,false
andtrue
. You will notice that conditional expressions considerfalse
andnil
as false and anything else as true.Numbers
—Represents real (double-precision floating-point) numbers.String
—AString
is a sequence of characters. 8-bit characters and embedded zeros are allowed.Tables
—A data structure in Lua. It is implemented by an associative array, which is an array that can be indexed not only with numbers, but also with strings or any other value, exceptnil
. (We will discuss more about this in the section Tables later in this chapter).Functions
—Known as first-class values of Lua. Typically, functions can be stored in variables, passed as arguments to other functions and returned as results.
推薦閱讀
- 龍芯應用開發標準教程
- Python GUI Programming:A Complete Reference Guide
- Deep Learning with PyTorch
- 基于ARM的嵌入式系統和物聯網開發
- Machine Learning with Go Quick Start Guide
- 數字媒體專業英語(第2版)
- The Artificial Intelligence Infrastructure Workshop
- FPGA實驗實訓教程
- Arduino項目案例:游戲開發
- Angular 6 by Example
- FPGA實戰訓練精粹
- 計算機組裝、維護與維修項目教程
- The Reinforcement Learning Workshop
- 分布式存儲系統:核心技術、系統實現與Go項目實戰
- 筆記本電腦的結構、原理與維修