z_mirror/luapls

git clone https://git.raiguard.me/z_mirror/luapls

Caleb HeuerPreparations for types v2bcf02cf

main
1.2 KiB73 linesraw
1--- @diagnostic disable:unused-local,unused-function
2
3--- @class Foo
4--- @field field Bar
5
6--- @class Bar
7--- @field field Foo
8
9local other = require("demos.demo2")
10
11local num = 3
12local other_num = num
13local other_other_num = other_num
14local other_other_other_num = other_other_num
15
16--- @type number
17local uninitialized
18
19local str, bool = "foo", true
20local unknown = nil
21local func = function(foo, bar) end
22
23local type_error = num + str
24
25--- Returns the sum of two numbers.
26--- @param a number
27--- @param b number
28--- @return number
29local function add(a, b)
30  return a + b
31end
32
33local baz = add(true, 3)
34
35--- Returns the difference of two numbers.
36--- @param a number
37--- @param b number
38--- @return number
39local sub = function(a, b)
40  return a - b
41end
42
43--- @param input string
44local function print(input) end
45
46local tbl = {
47  first = 1,
48  second = "two",
49  third = true,
50}
51
52tbl.fourth = function() end
53
54print(tbl.fourth)
55
56--- @param first string
57function tbl.fifth(first) end
58
59tbl.sixth = function(first, ...)
60  print"bar"
61end
62
63script.on_event(defines.events.on_player_created, function(e)
64  local player = game.get_player(e.player_index)
65  if not player then
66    return
67  end
68  player.print("Hello, world!")
69end)
70
71for i = 1, 10 do
72  print(i)
73end