Loading...
  OR  Zero-K Name:    Password:   

Post edit history

train your LUA skills

To display differences between versions, select one or more edits in the list using checkboxes and click "diff selected"
Post edit history
Date Editor Before After
10/4/2015 6:59:48 AMPLrankRafalpluk before revert after revert
10/4/2015 6:59:25 AMPLrankRafalpluk before revert after revert
10/4/2015 6:59:09 AMPLrankRafalpluk before revert after revert
10/4/2015 6:57:55 AMPLrankRafalpluk before revert after revert
10/4/2015 6:57:21 AMPLrankRafalpluk before revert after revert
10/4/2015 6:56:16 AMPLrankRafalpluk before revert after revert
10/4/2015 6:53:52 AMPLrankRafalpluk before revert after revert
10/4/2015 6:47:05 AMPLrankRafalpluk before revert after revert
10/4/2015 6:46:42 AMPLrankRafalpluk before revert after revert
10/4/2015 6:46:02 AMPLrankRafalpluk before revert after revert
10/4/2015 6:44:10 AMPLrankRafalpluk before revert after revert
10/4/2015 6:44:00 AMPLrankRafalpluk before revert after revert
10/4/2015 6:43:41 AMPLrankRafalpluk before revert after revert
10/4/2015 6:43:18 AMPLrankRafalpluk before revert after revert
10/4/2015 6:42:56 AMPLrankRafalpluk before revert after revert
10/4/2015 6:42:29 AMPLrankRafalpluk before revert after revert
10/4/2015 6:41:09 AMPLrankRafalpluk before revert after revert
10/4/2015 6:40:35 AMPLrankRafalpluk before revert after revert
10/4/2015 6:39:57 AMPLrankRafalpluk before revert after revert
10/4/2015 6:39:38 AMPLrankRafalpluk before revert after revert
10/4/2015 6:39:01 AMPLrankRafalpluk before revert after revert
10/4/2015 6:38:23 AMPLrankRafalpluk before revert after revert
10/4/2015 6:37:31 AMPLrankRafalpluk before revert after revert
10/4/2015 6:36:34 AMPLrankRafalpluk before revert after revert
10/4/2015 6:30:37 AMPLrankRafalpluk before revert after revert
10/4/2015 6:30:15 AMPLrankRafalpluk before revert after revert
10/4/2015 6:30:01 AMPLrankRafalpluk before revert after revert
Before After
1 After experimenting with it a bit I see its potential, but unfortunately it also has some flaws that make it teach people to write bad Lua code. 1 After experimenting with it a bit I see its potential, but unfortunately it also has some flaws that make it teach people to write bad Lua code.
2 \n 2 \n
3 It limits the execution of each callin function to a certain number (usually 5000) of lines of code. You can check how much lines you have left using builtin getNumberOfLines() function. The problem is that counting of executed lines of code is implemented in the most braindead way possible and is very abusable. 3 It limits the execution of each callin function to a certain number (usually 5000) of lines of code. You can check how much lines you have left using builtin getNumberOfLines() function. The problem is that counting of executed lines of code is implemented in the most braindead way possible and is very abusable.
4 \n 4 \n
5 Some examples: 5 Some examples:
6 [spoiler] 6 ( it is long) [spoiler]
7 This counts as 2 lines of code: 7 This counts as 2 lines of code:
8 [quote]a = 1 8 [quote]a = 1
9 b = 2[/quote] 9 b = 2[/quote]
10 \n 10 \n
11 But at the same time this counts as only one: 11 But at the same time this counts as only one:
12 [quote]a = 1; b = 2[/quote] 12 [quote]a = 1; b = 2[/quote]
13 Or using nice Lua syntax: 13 Or using nice Lua syntax:
14 [quote]a, b = 1, 2[/quote] 14 [quote]a, b = 1, 2[/quote]
15 \n 15 \n
16 From here it only gets worse. These also count as 1 line of code: 16 From here it only gets worse. These also count as 1 line of code:
17 [quote]a = { b = 1, c = 2, d = { e = 3, f = 4}, g = 6 }[/quote] 17 [quote]a = { b = 1, c = 2, d = { e = 3, f = 4}, g = 6 }[/quote]
18 [quote]if (a == 1) then b = 2 else b = 3 end[/quote] 18 [quote]if (a == 1) then b = 2 else b = 3 end[/quote]
19 You see where this is going... 19 You see where this is going...
20 \n 20 \n
21 \n 21 \n
22 The only bottleneck seem to be function calls (which count as 2 lines + whatever is in function body) and loops which count as at least as much as number of iterations they do. 22 The only bottleneck seem to be function calls (which count as 2 lines + whatever is in function body) and loops which count as at least as much as number of iterations they do.
23 (in the following code I am using triangle brackets instead of square ones to avoid breaking the forum formatting) 23 (in the following code I am using triangle brackets instead of square ones to avoid breaking the forum formatting)
24 \n 24 \n
25 So a loop like this: 25 So a loop like this:
26 [quote]for i = 1, 5 do a<i> = 2 * i end[/quote]Counts as 5 lines of code, which is the minimum. 26 [quote]for i = 1, 5 do a<i> = 2 * i end[/quote]Counts as 5 lines of code, which is the minimum.
27 \n 27 \n
28 But you must be careful with these, because: 28 But you must be careful with these, because:
29 [quote]for i = 1, 5 do 29 [quote]for i = 1, 5 do
30 a<i> = 2 * i 30 a<i> = 2 * i
31 end[/quote]already counts as 10 lines. 31 end[/quote]already counts as 10 lines.
32 \n 32 \n
33 While the noob way: 33 While the noob way:
34 [quote]a<1> = 2; a<2> = 4; a<3> = 6; a<4> = 8; a<5> = 10[/quote]counts as only one! 34 [quote]a<1> = 2; a<2> = 4; a<3> = 6; a<4> = 8; a<5> = 10[/quote]counts as only one!
35 [/spoiler] ( it is long) 35 [/spoiler]
36 \n 36 \n
37 All of this leads the code of top-performing bots to look like this: 37 All of this leads the code of top-performing bots to look like this:
38 [img]http://i.prntscr.com/77b0354b11754432a603c1316646da6a.png[/img] 38 [img]http://i.prntscr.com/77b0354b11754432a603c1316646da6a.png[/img]
39 Which doesn't really help code readibility and reusability... 39 Which doesn't really help code readibility and reusability...
40 \n 40 \n