-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstructures.lua
290 lines (227 loc) · 8.04 KB
/
structures.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
--- Table used by `http.request` function.
---@class HTTPRequest
local HTTPRequest = {}
--- Request method, case insensitive. Possible values are:
--- * GET
--- * POST
--- * HEAD
--- * PUT
--- * DELETE
--- * PATCH
--- * OPTIONS
---@type string?
HTTPRequest.method = nil
--- The target url
---@type string
HTTPRequest.url = nil
--- KeyValue table for parameters. This is only applicable to the following request methods:
--- * GET
--- * POST
--- * HEAD
---@type table?
HTTPRequest.parameters = nil
--- KeyValue table for headers
---@type table?
HTTPRequest.headers = nil
--- Body string for POST data. If set, will override parameters
---@type string?
HTTPRequest.body = nil
--- Content type for body.
---@type string?
HTTPRequest.type = "text/plain; charset=utf-8"
--- The timeout for the connection.
---@type number?
HTTPRequest.timeout = 60
--- Whether to cache the response.
---@type boolean?
HTTPRequest.cache = false
--- The cache lifetime for the request.
---@type number?
HTTPRequest.lifetime = nil
--- Whether to use ETag caching.
---@type boolean?
HTTPRequest.etag = false
--- The success callback.
---@class HTTPResponse
local HTTPResponse = {}
--- The response status code.
---@type number
HTTPResponse.status = nil
--- The response body.
---@type string
HTTPResponse.body = nil
--- The response headers.
---@type table
HTTPResponse.headers = nil
--- The server information table.
---@class ServerInfo
local ServerInfo = {}
--- The server ping.
---@type number
ServerInfo.ping = 0
--- The server name.
---
--- This value is set on the server by the []() convar.
---@type string
ServerInfo.name = "Garry's Mod"
--- The server map.
---@type string
ServerInfo.map_name = "gm_construct"
--- Contains the version number of GMod.
---@type number
ServerInfo.version = 201211
--- The server address.
---@type string
ServerInfo.address = "127.0.0.1:27015"
--- Two digit country code in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) standard.
---
--- This value is set on the server by the [sv_location](https://wiki.facepunch.com/gmod/Downloading_a_Dedicated_Server#locationflag) convar.
---@type string?
ServerInfo.country = nil
--- Time when you last played on this server, as UNIX timestamp or 0.
---@type number
ServerInfo.last_played_time = 0
--- Whether this server has password or not.
---@type boolean
ServerInfo.has_password = false
--- Is the server signed into an anonymous account?
---@type boolean
ServerInfo.is_anonymous = false
--- The number of players on the server.
---@type number
ServerInfo.player_count = 0
--- The maximum number of players on the server.
---@type number
ServerInfo.player_limit = 0
--- The number of bots on the server.
---@type number
ServerInfo.bot_count = 0
--- The number of humans on the server.
---@type number
ServerInfo.human_count = 0
--- The [gamemode folder](https://wiki.facepunch.com/gmod/Gamemode_Creation#gamemodefolder) name and the [`GM.Folder`](https://wiki.facepunch.com/gmod/Gamemode_Creation#gamemodefoldername) value.
---@type string
ServerInfo.gamemode_name = "sandbox"
--- The [`GM.Name`](https://wiki.facepunch.com/gmod/Gamemode_Creation#sharedlua) value.
---@type string
ServerInfo.gamemode_title = "Sandbox"
--- ID of the gamemode in Steam Workshop.
---@type string?
ServerInfo.gamemode_wsid = nil
--- The [category](https://wiki.facepunch.com/gmod/Gamemode_Creation#gamemodetextfile) of the gamemode, ex. `pvp`, `pve`, `rp` or `roleplay`.
---@type string
ServerInfo.gamemode_category = "other"
--- Used for [serverlist.Query](https://wiki.facepunch.com/gmod/serverlist.Query).
---@class ServerQueryData
local ServerQueryData = {}
--- The game directory to get the servers for
---@type string
ServerQueryData.directory = "garrysmod"
--- Type of servers to retrieve. Valid values are `internet`, `favorite`, `history` and `lan`
---@type string
ServerQueryData.type = nil
--- Steam application ID to get the servers for
---@type number
ServerQueryData.appid = 4000
--- Called when a new server is found and queried.
---
--- Function argument(s):
--- * number `ping` - Latency to the server.
--- * string `name` - Name of the server
--- * string `gamemode_title` - "Nice" gamemode name
--- * string `map_name` - Current map
--- * number `player_count` - Total player number ( bot + human )
--- * number `player_limit` - Maximum reported amount of players
--- * number `bot_count` - Amount of bots on the server
--- * boolean `has_password` - Whether this server has password or not
--- * number `last_played_time` - Time when you last played on this server, as UNIX timestamp or 0
--- * string `address` - IP Address of the server
--- * string `gamemode_name` - Gamemode folder name
--- * number `gamemode_wsid` - Gamemode Steam Workshop ID
--- * boolean `is_anonymous` - Is the server signed into an anonymous account?
--- * string `version` - Version number, same format as jit.version_num
--- * string `country` - Two digit country code, `us` if nil
--- * string `gamemode_category` - Category of the gamemode, ex. `pvp`, `pve`, `rp` or `roleplay`
---
--- Function return value(s):
--- * boolean `stop` - Return `false` to stop the query.
---@type fun(ping: number, name: string, gamemode_title: string, map_name: string, player_count: number, player_limit: number, bot_count: number, has_password: boolean, last_played_time: number, address: string, gamemode_name: string, gamemode_wsid: number, is_anonymous: boolean, version: string, country: string, gamemode_category: string): boolean
ServerQueryData.server_queried = nil
--- Called if the query has failed, called with the servers IP Address
---@type function
ServerQueryData.query_failed = nil
--- Called when the query is finished. No arguments
---@type function
ServerQueryData.finished = nil
--- Table used by `console.Variable` class constructor.
---@class ConsoleVariableData
local ConsoleVariableData = {}
--- The name of the console variable.
---@type string
ConsoleVariableData.name = nil
--- The type of the console variable.
---@type ConsoleVariableType?
ConsoleVariableData.type = nil
--- The flags of the console variable.
---@type gpm.std.FCVAR?
ConsoleVariableData.flags = nil
--- The default value of the console variable.
---@type string | number | boolean | nil
ConsoleVariableData.default = nil
--- The description of the console variable.
---@type string?
ConsoleVariableData.description = nil
--- The minimal value of the console variable.
---@type number?
ConsoleVariableData.min = nil
--- The maximum value of the console variable.
---@type number?
ConsoleVariableData.max = nil
--- The result table of executing `file.path.parse`.
---@class ParsedFilePath
local ParsedFilePath = {}
--- The root of the file path.
---@type string
ParsedFilePath.root = ""
--- The directory of the file path.
---@type string
ParsedFilePath.dir = ""
--- The basename of the file path.
---@type string
ParsedFilePath.base = ""
--- The name of the file path.
---@type string
ParsedFilePath.name = ""
--- The extension of the file path.
---@type string
ParsedFilePath.ext = ""
--- Whether the file path is absolute.
---@type boolean
ParsedFilePath.abs = false
--- The params table that was used in `Addon` search functions.
---@class WorkshopSearchParams
local WorkshopSearchParams = {}
--- The type of items to retrieve.
---@type gpm.std.WORKSHOP_SEARCH?
WorkshopSearchParams.type = nil
--- A table of tags to match.
---@type string[]?
WorkshopSearchParams.tags = nil
--- How much of results to skip from first one.
---@type number?
WorkshopSearchParams.offset = 0
--- How many items to retrieve, up to 50 at a time.
---@type number?
WorkshopSearchParams.count = 50
--- This determines a time period, in range of days from 0 to 365.
---@type number?
WorkshopSearchParams.days = 365
--- If specified, receives items from the workshop created by the owner of SteamID64.
---@type string?
WorkshopSearchParams.steamid64 = "0"
--- If specified, retrieves items from your workshop, and also eliminates the 'steamid64' key.
---@type boolean?
WorkshopSearchParams.owned = false
--- Response time, after which the function will be terminated with an error (default 30)
---@type number?
WorkshopSearchParams.timeout = 30