1× editiert, zuletzt 18.09.15 02:26:25
Forum
CS2D Scripts What is Table?What is Table?
10 Antworten 1
1× editiert, zuletzt 18.09.15 01:27:02
Scroll down to Variables II.
Paulo49 hat geschrieben
some
Racist
Mami Tomoe hat geschrieben
Racist
Chill, his problem is solved.
Zitat
What is Table?
Answer:
This is a table.
You will see most tables in addition with something suspicious called 'chair'. Here's a image if you also dont know it.
Ps: no need to thank me, im glad that i could help.
Well to make it short: A table is a variable that actually holds many other variables.
Here's a example:
1
2
3
4
2
3
4
pseudo_table = {5, 10, 15, 1, 3, 100}; for i = 1, #pseudo_table do 	print(pseudo_table[i]); end
Imagine if there were no tables:
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
a = 5; b = 10; c = 15; d = 1; e = 3; f = 100; print(a); print(b); print(c); print(d); print(e); print(f);
Something special in lua is that a table can store many variables of many types. Unlike in c++ or in many other programming languages.
LUA
1
pseudo_table = {100, 50, 20, "This is a string!", "hey another string :D", 5.0, 3.0};
C++
1
2
3
2
3
int pseudo_array_int[3] = {100, 50, 20}; std::string pseudo_array_string[2] = {"This is a string!", "hey another string :D"}; float pseudo_array_float[2] = {5.0f, 3.0f};
1