Similar presentations:
Lua data types
1.
“Lua data types”Prepared by: S. S. Kochetkov
ИФИмд-19
2.
OUTLINE1. Basic Lua data types
2. Using of different types of data
3. Type conversion
2
3.
PURPOSE• to convey to the audience full information about lua data
types in a convenient form, to study the data types that lua
gives, to learn how to use variables of various types and
convert them to each other.
3
4.
Semicolon“a camel is a horse developed by a committee”
;
4
5.
The First Point: Basic Lua data typesType
nil
boolean
number
string
table
function
userdata
thread
5
Example
a = nil
b = true
n=1
s = 'abc'
t = {a, b, c}
foo = function(x) return 2*x end
u = some_C_struct
co = coroutine.create( function () print("hi") end)
6.
The Second Point:Using of different types of data
Boolean
6
7.
The Second Point:Using of different types of data
Number
7
8.
The Second Point:Using of different types of data
String
8
9.
The Second Point:Using of different types of data
String
9
10.
The Second Point: Using of different types of data10
11.
The Second Point:Using of different types of data
Table
11
12.
The Second Point:Using of different types of data
Table
12
13.
The Second Point:Using of different types of data
Table
13
14.
15.
The Second Point:Using of different types of data
Table
15
16.
The Second Point:Using of different types of data
Function
16
17.
The Second Point:Using of different types of data
Function
17
18.
The Second Point:Using of different types of data
Function
18
19.
The Third Point: Type conversionTo boolean
19
20.
The Third Point: Type conversionTo number
20
21.
The Third Point: Type conversionTo string
21
22.
SUMMARY1. There are eight basic types in
Lua: nil, boolean, number, string, userdata, function, threa
d, and table.
2. Variables have no predefined types - any variable may
contain values of any type
3. Lua has its own type conversion system.
22
23.
CONCLUSIONRemember the features of data types in lua
Consider type conversion mechanisms when writing programs
23
24.
ReferencesProgramming in Lua (first edition) (eng) - is a detailed and
authoritative introduction to all aspects of Lua programming
written by Lua's chief architect
tutorialspoint.com (eng) – is online tutorial for self-study
24
25.
Thanks for attentionContacts
[email protected]
+79779502335
25