-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathslua_definitions.schema.json
More file actions
451 lines (451 loc) · 17.6 KB
/
Copy pathslua_definitions.schema.json
File metadata and controls
451 lines (451 loc) · 17.6 KB
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
{
"$schema": "http://json-schema.org/draft/2019-09/schema",
"$id": "http://raw.githubusercontent.com/secondlife/lsl-definitions/refs/heads/main/slua_definitions.schema.json",
"$comment": "This schema defines keywords for the Server Lua Language (SLua) of Second Life.",
"$defs": {
"identifier": {
"pattern": "^[_a-zA-Z][_a-zA-Z0-9]*$",
"type": "string"
},
"type": {
"markdownDescription": "A luau-format type definition.",
"pattern": "^([ \n?&|,{}\\[\\]()<>:a-zA-Z0-9_]|\"[^\"]*\"|\\.\\.\\.|->)*$",
"type": "string"
},
"selene-type": {
"title": "A type understood by selene.",
"description": "See https://kampfkarren.github.io/selene/usage/std.html#properties.",
"oneOf": [
{"enum": ["any", "bool", "function", "nil", "number", "string", "table"]},
{"type": "array", "items": {"type": "string"}},
{"type": "object", "additionalProperties": false, "properties": {"display": {"type": "string"}}}
]
},
"deprecated": {
"markdownDescription": "This function or property has been deprecated.",
"oneOf": [
{"type": "boolean" , "const": true},
{
"type": "object",
"additionalProperties": false,
"properties": {
"reason": {
"markdownDescription": "The reason for deprecation.",
"type": "string"
},
"use": {
"markdownDescription": "What to use instead.",
"type": "string"
},
"selene-replace": {
"markdownDescription": "Pattern replacements for selene.",
"type": "array",
"items": {"type": "string"}
}
}
}
]
},
"property": {
"markdownDescription": "A property or constant.",
"additionalProperties": false,
"properties": {
"name": { "$ref": "#/$defs/identifier" },
"type": { "$ref": "#/$defs/type" },
"value": {
"markdownDescription": "The value of the constant.",
"type": ["number", "string"]
},
"comment": {
"markdownDescription": "A brief description of this constant.",
"type": "string"
},
"modifiable": {
"title": "Passed through to the selene `property` field.",
"description": "See https://kampfkarren.github.io/selene/usage/std.html#properties.",
"enum": ["read-only", "new-fields", "override-fields", "full-write"],
"default": "read-only"
}
},
"required": ["name", "type"],
"type": "object"
},
"type-alias": {
"markdownDescription": "A type alias.",
"additionalProperties": false,
"properties": {
"name": { "$ref": "#/$defs/identifier" },
"definition": { "$ref": "#/$defs/type" },
"selene-type": { "$ref": "#/$defs/selene-type" },
"comment": {
"markdownDescription": "A brief description of this alias.",
"type": "string"
},
"export": {
"const": true,
"markdownDescription": "Whether this type is available to users.",
"type": "boolean"
}
},
"required": ["name", "definition", "selene-type"],
"type": "object"
},
"function-parameter": {
"markdownDescription": "A function parameter.",
"additionalProperties": false,
"properties": {
"name": { "oneOf": [
{ "$ref": "#/$defs/identifier" },
{ "const": "...", "type": "string" }
]},
"type": { "$ref": "#/$defs/type" },
"selene-type": { "$ref": "#/$defs/selene-type" },
"optional": {
"title": "Is this parameter optional.",
"markdownDescription": "Defaults to true if type ends in `?`, false otherwise.",
"type": "boolean"
},
"observes": {
"title": "Hint for unused variable detection.",
"description": "See https://kampfkarren.github.io/selene/usage/std.html#observes.",
"enum": ["read-write", "read", "write"],
"default": "read-write"
},
"comment": {
"markdownDescription": "A brief description of this parameter.",
"type": "string"
},
"default-value": {
"markdownDescription": "The default value of this parameter when omitted.",
"type": ["string", "number", "boolean", "null"]
}
},
"required": ["name"],
"type": "object"
},
"function-anon": {
"markdownDescription": "A plain function signature; no name or overloads.",
"additionalProperties": false,
"properties": {
"type-parameters": {
"items": {
"pattern": "^(\\.\\.\\.)?[_a-zA-Z][_a-zA-Z0-9]*(\\.\\.\\.)?$",
"type": "string"
},
"type": "array"
},
"parameters": {
"items": { "$ref": "#/$defs/function-parameter" },
"type": "array"
},
"return-type": { "$ref": "#/$defs/type" },
"comment": {
"markdownDescription": "A brief description of this function.",
"type": "string"
}
},
"required": [],
"type": "object"
},
"function-variant": {
"markdownDescription": "An alternative structure or shape for a function.",
"additionalProperties": false,
"properties": {
"comment": {
"markdownDescription": "A brief description of this variant.",
"type": "string"
},
"parameters": {
"items": { "$ref": "#/$defs/function-parameter" },
"type": "array"
},
"return-type": { "$ref": "#/$defs/type" }
},
"type": "object"
},
"function": {
"markdownDescription": "A full function signature.",
"additionalProperties": false,
"properties": {
"name": { "$ref": "#/$defs/identifier" },
"type-parameters": {
"items": {
"pattern": "^(\\.\\.\\.)?[_a-zA-Z][_a-zA-Z0-9]*(\\.\\.\\.)?$",
"type": "string"
},
"type": "array"
},
"parameters": {
"items": { "$ref": "#/$defs/function-parameter" },
"type": "array"
},
"return-type": { "$ref": "#/$defs/type" },
"overloads": {
"items": { "$ref": "#/$defs/function-anon" },
"type": "array"
},
"variants": {
"items": { "$ref": "#/$defs/function-variant" },
"type": "array"
},
"deprecated": { "$ref": "#/$defs/deprecated" },
"local-only": {
"const": true,
"markdownDescription": "This function is not available in-world, only locally.",
"type": "boolean"
},
"slua-removed": {
"const": true,
"markdownDescription": "This function is only present in Luau, not SLua.",
"type": "boolean"
},
"must-use": {
"const": true,
"title": "Give a warning if the return value is not used.",
"description": "See https://kampfkarren.github.io/selene/usage/std.html#must_use.",
"type": "boolean"
},
"fastcall": {
"const": true,
"title": "This function has a dedicated bytecode in the luau vm.",
"description": "See https://github.com/secondlife/slua/blob/main/Common/include/Luau/Bytecode.h#L542",
"type": "boolean"
},
"comment": {
"markdownDescription": "A brief description of this function.",
"type": "string"
},
"typechecker": {
"type": "object",
"description": "Flags specific to the internals of luau-analyze and luau-lsp.",
"additionalProperties": false,
"properties": {
"builtin": {
"const": true,
"description": "This function is defined in BuiltinDefinitions.cpp, rather than EmbeddedBuiltinDefinitions.cpp.",
"type": "boolean"
},
"magic": {
"const": true,
"description": "The typechecker has custom logic for this function. Look for attachMagicFunction in the source code.",
"type": "boolean"
},
"checked": {
"const": true,
"markdownDescription": "This function's run-time type checks match the typechecker. Functions with checked types report the same errors in --!strict and --!nonstrict modes.",
"type": "boolean"
}
}
}
},
"required": ["name"],
"type": "object"
},
"class": {
"markdownDescription": "A type with properties and methods.",
"additionalProperties": false,
"properties": {
"name": { "$ref": "#/$defs/identifier" },
"instance-type": { "$ref": "#/$defs/type" },
"export": {
"const": true,
"markdownDescription": "Whether this type is available to users. Only applicable if instance-type is specified.",
"type": "boolean"
},
"properties": {
"items": { "$ref": "#/$defs/property" },
"type": "array"
},
"functions": {
"items": { "$ref": "#/$defs/function" },
"type": "array"
},
"methods": {
"items": { "$ref": "#/$defs/function" },
"type": "array"
},
"comment": {
"markdownDescription": "A brief description of this type.",
"type": "string"
}
},
"required": ["name"],
"type": "object"
},
"module": {
"markdownDescription": "A table with constants and functions.",
"additionalProperties": false,
"properties": {
"name": { "$ref": "#/$defs/identifier" },
"callable": { "$ref": "#/$defs/function" },
"constants": {
"items": { "$ref": "#/$defs/property" },
"type": "array"
},
"functions": {
"items": { "$ref": "#/$defs/function" },
"type": "array"
},
"comment": {
"markdownDescription": "A brief description of this type.",
"type": "string"
}
},
"required": ["name", "comment"],
"type": "object"
},
"metamethod-variant": {
"markdownDescription": "An alternative structure or shape for a metamethod.",
"additionalProperties": false,
"properties": {
"comment": {
"markdownDescription": "A brief description of this variant.",
"type": "string"
},
"type": {
"markdownDescription": "The type of this specific variant.",
"type": "string"
},
"parameters": {
"items": { "$ref": "#/$defs/function-parameter" },
"type": "array"
},
"return-type": { "$ref": "#/$defs/type" }
},
"required": ["type"],
"type": "object"
},
"metamethod-definition": {
"markdownDescription": "A metamethod signature and description.",
"additionalProperties": false,
"properties": {
"name": {
"markdownDescription": "The name of the metamethod.",
"pattern": "^__[a-z]+$",
"type": "string"
},
"comment": {
"markdownDescription": "A brief description of this metamethod.",
"type": "string"
},
"type-parameters": {
"items": {
"pattern": "^(\\.\\.\\.)?[_a-zA-Z][_a-zA-Z0-9]*(\\.\\.\\.)?$",
"type": "string"
},
"type": "array"
},
"type": {
"markdownDescription": "The combined or primary type of this metamethod.",
"type": "string"
},
"parameters": {
"items": { "$ref": "#/$defs/function-parameter" },
"type": "array"
},
"return-type": { "$ref": "#/$defs/type" },
"variants": {
"items": { "$ref": "#/$defs/metamethod-variant" },
"type": "array"
}
},
"required": ["name"],
"type": "object"
}
},
"additionalProperties": false,
"properties": {
"version": {
"markdownDescription": "Only increment with file format changes.",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
"type": "string"
},
"base-classes": {
"items": { "$ref": "#/$defs/class" },
"type": "array"
},
"type-aliases": {
"items": { "$ref": "#/$defs/type-alias" },
"type": "array"
},
"classes": {
"items": { "$ref": "#/$defs/class" },
"type": "array"
},
"global-variables": {
"items": { "$ref": "#/$defs/property" },
"type": "array"
},
"functions": {
"items": { "$ref": "#/$defs/function" },
"type": "array"
},
"modules": {
"items": { "$ref": "#/$defs/module" },
"type": "array"
},
"constants": {
"items": { "$ref": "#/$defs/property" },
"type": "array"
},
"builtin-constants": {
"items": { "$ref": "#/$defs/property" },
"type": "array"
},
"controls": {
"markdownDescription": "The Luau keywords.",
"additionalProperties": false,
"patternProperties": {
"^(?:[a-z]+)$": {
"properties": {
"tooltip": {
"markdownDescription": "A brief description of this keyword.",
"type": "string"
}
},
"required": ["tooltip"],
"type": "object"
}
},
"type": "object"
},
"builtin-types": {
"markdownDescription": "The Luau builtin types.",
"additionalProperties": false,
"patternProperties": {
"^[a-z]*": {
"properties": {
"tooltip": {
"markdownDescription": "A brief description of this type.",
"type": "string"
}
},
"required": [
"tooltip"
],
"type": "object"
}
},
"type": "object"
},
"metamethods": {
"items": { "$ref": "#/$defs/metamethod-definition" },
"type": "array"
}
},
"required": [
"version",
"base-classes",
"type-aliases",
"classes",
"functions",
"modules",
"constants",
"controls",
"builtin-types",
"builtin-constants",
"metamethods"
],
"title": "Second Life SLua Definitions",
"type": "object"
}