반응형
Value Type | Description |
---|---|
nil | Used to differentiate the value from having some data or no(nil) data. |
boolean | Includes true and false as values. Generally used for condition checking. |
number | Represents real(double precision floating point) numbers. |
string | Represents array of characters. |
function | Represents a method that is written in C or Lua. |
userdata | Represents arbitary C data. |
thread | Represents independent threads of execution and it is used to implement coroutines. |
table | Represent ordinary arrays, symbol tables, sets, records, graphs, trees, etc, and implements associative arrays. It can hold any value (except nil). |
예제
print(type("What is my type")) --> stringt=10print(type(5.8*t)) --> numberprint(type(true)) --> booleanprint(type(print)) --> functionprint(type(type)) --> functionprint(type(nil)) --> nilprint(type(type(ABC))) --> string
When you build and execute the above program it produces following result on Linux:
stringnumberfunctionfunctionbooleannilstring
출처 : http://www.tutorialspoint.com/lua/lua_data_types.htm
반응형
'언어 > lua' 카테고리의 다른 글
6. 중간 정리 (0) | 2015.12.01 |
---|---|
5. 연산자 (0) | 2015.12.01 |
3. 함수 (0) | 2015.12.01 |
2. 개발환경 세팅 (0) | 2015.12.01 |
1. Lua 설치 및 설정 (0) | 2015.12.01 |