Skip to content

Commit 3dbd4f2

Browse files
authored
Add files via upload
1 parent 757c735 commit 3dbd4f2

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

lua_note.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
## Variable type
2+
3+
* Nil : None
4+
* Boolean : true or false
5+
* Number : int or float
6+
* string : characters
7+
8+
declare-> just use '=' to declare variable name and the value should stored
9+
10+
* variable name can't start with number but can contain them
11+
12+
* variable names can't contain symbol but '_'
13+
14+
* variables are case sensitive
15+
16+
use '--' to make a comment
17+
18+
* table : like python dictionary. you can use table to store various type of variables.
19+
sample:
20+
21+
> table = {} -- declare a table
22+
> table.num = 10 -- number in table
23+
> table.table2 = {} -- table in table
24+
> table2 = {num = 10, table3 = {}}
25+
26+
---
27+
## if operators
28+
==:equal
29+
~=:not equal
30+
< :less
31+
\> :greater
32+
<=:less or equal
33+
\>=:greater or equal
34+
35+
> if condition then
36+
> --trigger
37+
> end
38+
39+
> if condition and condition2 then
40+
> --trigger
41+
> elseif confition3 then
42+
> --trigger
43+
> else
44+
> --trigger
45+
> end
46+
47+
---
48+
49+
## function
50+
51+
> function function_name()
52+
> -- trigger and detect
53+
>end
54+
55+
love2D 3 main function
56+
57+
>function love.load()
58+
> -- will trigger when you start the game
59+
> -- where you load all the data and assets
60+
>end
61+
62+
>function love.update(dt)
63+
> -- program the actual game logic
64+
> -- anything you need to update will in the end be handled in here
65+
> -- will trigger 1 time per frame produced by computer. Depend on your computer.
66+
> -- might be run mutiple times of others.
67+
> -- so we need 'dt' as delta time to make adjust as index.
68+
>end
69+
70+
>function love.draw()
71+
> -- display graphics on the screen
72+
>end
73+

0 commit comments

Comments
 (0)