File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- A local variable masking a global one:
2
+ global_variable = ' 1st value'
3
+ do
4
+ local global_variable = ' NOT ACTUALLY A GLOBAL!'
5
+ print (global_variable )
6
+ end
7
+ global_variable = ' 2nd value'
8
+
9
+ -- Highlighting for different types of locals:
10
+ local usedlocal = ' this is a local variable'
11
+ local mutated = " this one's assigned multiple times"
12
+ local unused = " and this one isn't referenced anywhere"
13
+ mutated = ' this is the second value of [mutated]'
14
+ print (usedlocal )
15
+ print (undefined )
16
+
17
+ io.open (' ' )
18
+ string.lower (' ' )
19
+ local tinsert = table.insert
20
+ local test = { field = function (foo , bar , baz ) print (baz ) end }
21
+
22
+ -- Highlighting for function arguments:
23
+ local function example (usedparam , mutatedparam , unusedparam )
24
+ mutatedparam = 42
25
+ print (usedparam )
26
+ end
27
+
28
+ -- Argument count checking:
29
+
30
+ example (1 )
31
+
32
+ for k , v in pairs (_G ) do print (k ) end
33
+
34
+ example (
35
+ 1 ,
36
+ 2 ,
37
+ 3 ,
38
+ 4 )
39
+
40
+ -- Syntax errors:
41
+ -- example(..)
You can’t perform that action at this time.
0 commit comments