forked from LuaLS/vscode-lua
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.lua
72 lines (58 loc) · 1.11 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local fTest = require('/function-test.lua')
local child = import("/child.lua")
child.childFunc()
local v = child.someValue
local t = {
val = 1
}
local y = t.val
---@param num number
function T(num)end
T(23 | 85)
local function mainFunc()
local var = 'some string'
return var
end
mainFunc()
---some comment
---@param test string
---@return integer
local function otherVal(test)
return 1
end
local someVal = function(arg)
return 'test'
end
---@class MyClass
--- hello
---@field aField "test"|"test2" hello2
local MyClass = {
---my comment
---@param self MyClass
---@param param1 any
---@return string
aFunction = function(self, param1)
return 's'
end,
decField = someVal,
newFunc = val2
}
local t = MyClass
---comment
---@param c MyClass
function callMe(c) end
callMe({
aField = "test",
aFunction = function() end
})
---@generic T: table, K, V
---@param t T
---@return fun(table: table<K, V>, index?: K):K, V
---@return T
function fixType(t)
return t
end
---@type table<number, MyClass>
local someTable = {}
for index, value in someTable do
end