Skip to content

Commit 5fe8076

Browse files
committed
share the arguments schema between functions and events
1 parent 9e08e46 commit 5fe8076

4 files changed

Lines changed: 93 additions & 91 deletions

File tree

‎generated/experimental/enum_users.json‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"CameraParam": [
3737
"llSetCameraParams"
3838
],
39-
"ChangeType": [],
39+
"ChangeType": [
40+
"changed"
41+
],
4042
"CharacterAvoidanceMode": [],
4143
"CharacterCommand": [
4244
"llExecCharacterCmd"
@@ -55,7 +57,9 @@
5557
"llCreateCharacter",
5658
"llUpdateCharacter"
5759
],
58-
"CharacterPathUpdateType": [],
60+
"CharacterPathUpdateType": [
61+
"path_update"
62+
],
5963
"CharacterPatrolPointsParam": [
6064
"llPatrolPoints"
6165
],
@@ -71,6 +75,8 @@
7175
"llSetClickAction"
7276
],
7377
"ControlButton": [
78+
"control",
79+
"control",
7480
"llTakeControls"
7581
],
7682
"DamageType": [
@@ -97,6 +103,7 @@
97103
"llManageEstateAccess"
98104
],
99105
"ExperienceError": [
106+
"experience_permissions_denied",
100107
"llGetExperienceErrorMessage"
101108
],
102109
"Faces": [
@@ -139,7 +146,9 @@
139146
"llSetLinkGLTFOverrides"
140147
],
141148
"GameControlAxis": [],
142-
"GameControlButton": [],
149+
"GameControlButton": [
150+
"game_control"
151+
],
143152
"GetClosestNavPointParam": [
144153
"llGetClosestNavPoint"
145154
],
@@ -158,7 +167,9 @@
158167
"HTTPRequestParam": [
159168
"llHTTPRequest"
160169
],
161-
"HTTPResponseError": [],
170+
"HTTPResponseError": [
171+
"http_response"
172+
],
162173
"InventoryType": [
163174
"llGetInventoryName",
164175
"llGetInventoryNumber"
@@ -205,7 +216,9 @@
205216
"llSetLinkTexture",
206217
"llSetLinkTextureAnim"
207218
],
208-
"LinksetDataAction": [],
219+
"LinksetDataAction": [
220+
"linkset_data"
221+
],
209222
"LinksetDataError": [],
210223
"ListEntryType": [],
211224
"ListStatisticsOperation": [
@@ -299,7 +312,9 @@
299312
"RayCastRejectType": [],
300313
"ReflectionProbeType": [],
301314
"RegionFlag": [],
302-
"RemoteDataEventType": [],
315+
"RemoteDataEventType": [
316+
"remote_data"
317+
],
303318
"ReturnObjectsError": [],
304319
"ReturnObjectsScope": [
305320
"llReturnObjectsByOwner"
@@ -309,6 +324,7 @@
309324
"llRezObjectWithParams"
310325
],
311326
"ScriptPermission": [
327+
"run_time_permissions",
312328
"llRequestPermissions"
313329
],
314330
"ScriptProfileMode": [

‎lsl_definitions.schema.json‎

Lines changed: 61 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,65 @@
128128
}
129129
]
130130
},
131+
"arguments": {
132+
"items": {
133+
"additionalProperties": false,
134+
"patternProperties": {
135+
"^(?:[A-Za-z]+(?:[A-z0-9-_]+)*)$": {
136+
"additionalProperties": false,
137+
"properties": {
138+
"asset-semantics": {
139+
"const": true,
140+
"markdownDescription": "This function argument's string value represents an asset name or uuid.",
141+
"type": "boolean"
142+
},
143+
"bool-semantics": {
144+
"const": true,
145+
"markdownDescription": "This function argument's integer value represents a boolean value.",
146+
"type": "boolean"
147+
},
148+
"index-semantics": {
149+
"const": true,
150+
"markdownDescription": "This function argument's integer value represents a zero-based index.",
151+
"type": "boolean"
152+
},
153+
"enum-semantics": {
154+
"pattern": "^[A-Z][A-Za-z]+$",
155+
"markdownDescription": "This function argument's integer value represents an enum value.",
156+
"type": "string"
157+
},
158+
"param-semantics": {
159+
"pattern": "^[A-Z][A-Za-z]+$",
160+
"markdownDescription": "This function argument's list value represents a parameter list to set.",
161+
"type": "string"
162+
},
163+
"param-get-semantics": {
164+
"pattern": "^[A-Z][A-Za-z]+$",
165+
"markdownDescription": "This function argument's list value represents a parameter list to get.",
166+
"type": "string"
167+
},
168+
"tooltip": {
169+
"markdownDescription": "A brief description of this function argument.",
170+
"type": "string"
171+
},
172+
"type": { "$ref": "#/$defs/lslType" },
173+
"slua-type": {
174+
"markdownDescription": "A more specific argument type for slua type-checking.",
175+
"type": "string"
176+
}
177+
},
178+
"required": [
179+
"type"
180+
],
181+
"type": "object"
182+
}
183+
},
184+
"type": "object"
185+
},
186+
"markdownDescription": "An array of function arguments.",
187+
"type": "array",
188+
"uniqueItems": true
189+
},
131190
"rulesetParamArray": {
132191
"items": {
133192
"items": false,
@@ -283,31 +342,7 @@
283342
"^[a-z_]+$": {
284343
"additionalProperties": false,
285344
"properties": {
286-
"arguments": {
287-
"items": {
288-
"additionalProperties": false,
289-
"patternProperties": {
290-
"^(?:[A-Za-z]+(?:_[A-Za-z]+)*)$": {
291-
"properties": {
292-
"tooltip": {
293-
"markdownDescription": "A brief description of this event argument.",
294-
"type": "string"
295-
},
296-
"type": { "$ref": "#/$defs/lslType" }
297-
},
298-
"required": [
299-
"type"
300-
],
301-
"type": "object"
302-
}
303-
},
304-
"type": "object"
305-
},
306-
"markdownDescription": "An array of event arguments.",
307-
"minItems": 0,
308-
"type": "array",
309-
"uniqueItems": true
310-
},
345+
"arguments": { "$ref": "#/$defs/arguments" },
311346
"detected-semantics": {
312347
"const": true,
313348
"markdownDescription": "Uses llDetected* in LSL and {DetectedEvent} in SLua.",
@@ -352,65 +387,7 @@
352387
"type": "array",
353388
"uniqueItems": true
354389
},
355-
"arguments": {
356-
"items": {
357-
"additionalProperties": false,
358-
"patternProperties": {
359-
"^(?:[A-Za-z]+(?:[A-z0-9-_]+)*)$": {
360-
"additionalProperties": false,
361-
"properties": {
362-
"asset-semantics": {
363-
"const": true,
364-
"markdownDescription": "This function argument's string value represents an asset name or uuid.",
365-
"type": "boolean"
366-
},
367-
"bool-semantics": {
368-
"const": true,
369-
"markdownDescription": "This function argument's integer value represents a boolean value.",
370-
"type": "boolean"
371-
},
372-
"index-semantics": {
373-
"const": true,
374-
"markdownDescription": "This function argument's integer value represents a zero-based index.",
375-
"type": "boolean"
376-
},
377-
"enum-semantics": {
378-
"pattern": "^[A-Z][A-Za-z]+$",
379-
"markdownDescription": "This function argument's integer value represents an enum value.",
380-
"type": "string"
381-
},
382-
"param-semantics": {
383-
"pattern": "^[A-Z][A-Za-z]+$",
384-
"markdownDescription": "This function argument's list value represents a parameter list to set.",
385-
"type": "string"
386-
},
387-
"param-get-semantics": {
388-
"pattern": "^[A-Z][A-Za-z]+$",
389-
"markdownDescription": "This function argument's list value represents a parameter list to get.",
390-
"type": "string"
391-
},
392-
"tooltip": {
393-
"markdownDescription": "A brief description of this function argument.",
394-
"type": "string"
395-
},
396-
"type": { "$ref": "#/$defs/lslType" },
397-
"slua-type": {
398-
"markdownDescription": "A more specific argument type for slua type-checking.",
399-
"type": "string"
400-
}
401-
},
402-
"required": [
403-
"type"
404-
],
405-
"type": "object"
406-
}
407-
},
408-
"type": "object"
409-
},
410-
"markdownDescription": "An array of function arguments.",
411-
"type": "array",
412-
"uniqueItems": true
413-
},
390+
"arguments": { "$ref": "#/$defs/arguments" },
414391
"asset-semantics": {
415392
"const": true,
416393
"markdownDescription": "The returned string value represents an asset name or uuid.",

‎lsl_definitions.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6334,7 +6334,7 @@ events:
63346334
- PermissionFlags:
63356335
tooltip: ''
63366336
type: integer
6337-
enum: ScriptPermission
6337+
enum-semantics: ScriptPermission
63386338
tooltip: "Scripts need permission from either the owner or the avatar they wish\
63396339
\ to act on before they may perform certain functions, such as debiting money\
63406340
\ from their owners account, triggering an animation on an avatar, or capturing\

‎lsl_definitions/generators/builtins_txt.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ def gen_enum_users(definitions: LSLDefinitions) -> str:
7373
# List of all enum users. Feel free to remove this rule
7474
out = {enum.name: [] for enum in sorted(definitions.enums.values(), key=lambda x: x.name)}
7575

76+
for event in sorted(definitions.events.values(), key=lambda x: x.name):
77+
for arg in event.arguments:
78+
if arg.enum_semantics:
79+
out[arg.enum_semantics.name].append(event.name)
80+
if arg.param_semantics:
81+
out[arg.param_semantics.name].append(event.name)
82+
if arg.param_get_semantics:
83+
out[arg.param_get_semantics.name].append(event.name)
84+
7685
for func in sorted(definitions.functions.values(), key=lambda x: x.name):
7786
for arg in func.arguments:
7887
if arg.enum_semantics:

0 commit comments

Comments
 (0)