언어/lua
4. 자료형
조규현15
2015. 12. 1. 09:03
반응형
| 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반응형