Skip to content

Commit 553b808

Browse files
authored
tovector, toquaternion, touuid now accept nil (#66)
1 parent 50ae38c commit 553b808

File tree

5 files changed

+53
-41
lines changed

5 files changed

+53
-41
lines changed

generated/slua_default.d.luau

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ end
146146

147147

148148
declare function dangerouslyexecuterequiredmodule(f: (...any) -> ...any): ...any
149-
declare function touuid(val: string | buffer | uuid): uuid?
150-
declare function tovector(val: string | vector): vector?
151-
declare function toquaternion(val: string | quaternion): quaternion?
152-
declare function torotation(val: string | quaternion): quaternion?
149+
declare function touuid(val: string? | buffer | uuid): uuid?
150+
declare function tovector(val: string? | vector): vector?
151+
declare function toquaternion(val: string? | quaternion): quaternion?
152+
declare function torotation(val: string? | quaternion): quaternion?
153153

154154
---------------------------
155155
-- Global Table: bit32
@@ -415,8 +415,8 @@ declare utf8: {
415415
-- Global Table: uuid
416416
---------------------------
417417

418-
declare uuid: ((value: string | buffer | uuid) -> uuid?) & {
419-
create: (value: string | buffer | uuid) -> uuid?,
418+
declare uuid: ((value: string? | buffer | uuid) -> uuid) & {
419+
create: (value: string? | buffer | uuid) -> uuid,
420420
}
421421

422422

generated/slua_default.docs.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"documentation": "Dangerously executes a required module function"
44
},
55
"@sl-slua/global/touuid": {
6-
"documentation": "Converts a string, buffer, or uuid to a uuid, returns nil if invalid"
6+
"documentation": "Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID, or the the buffer is shorter than 16 bytes."
77
},
88
"@sl-slua/global/tovector": {
99
"documentation": "Converts a string to a vector, returns nil if invalid"
@@ -735,10 +735,10 @@
735735
"learn_more_link": "https://create.roblox.com/docs/reference/engine/libraries/utf8#offset"
736736
},
737737
"@sl-slua/global/uuid": {
738-
"documentation": "Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID. Throws an error if the buffer is shorter than 16 bytes. Alias of uuid.create"
738+
"documentation": "Creates a new uuid from a string, buffer, or existing uuid. Throws an error if the string is not a valid UUID, or the the buffer is shorter than 16 bytes. Alias of uuid.create."
739739
},
740740
"@sl-slua/global/uuid.create": {
741-
"documentation": "Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID. Throws an error if the buffer is shorter than 16 bytes."
741+
"documentation": "Creates a new uuid from a string, buffer, or existing uuid. Throws an error if the string is not a valid UUID, or the the buffer is shorter than 16 bytes."
742742
},
743743
"@sl-slua/global/vector": {
744744
"documentation": "Creates a new vector with the given component values. Alias of vector.create.",

generated/slua_keywords_pretty.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11176,7 +11176,7 @@ vector position - position in local coordinates
1117611176
<key>tooltip</key>
1117711177
<string></string>
1117811178
<key>type</key>
11179-
<string>string | quaternion</string>
11179+
<string>string? | quaternion</string>
1118011180
</map>
1118111181
</map>
1118211182
</array>
@@ -11199,7 +11199,7 @@ vector position - position in local coordinates
1119911199
<key>tooltip</key>
1120011200
<string></string>
1120111201
<key>type</key>
11202-
<string>string | quaternion</string>
11202+
<string>string? | quaternion</string>
1120311203
</map>
1120411204
</map>
1120511205
</array>
@@ -11222,7 +11222,7 @@ vector position - position in local coordinates
1122211222
<key>tooltip</key>
1122311223
<string></string>
1122411224
<key>type</key>
11225-
<string>string | buffer | uuid</string>
11225+
<string>string? | buffer | uuid</string>
1122611226
</map>
1122711227
</map>
1122811228
</array>
@@ -11233,7 +11233,7 @@ vector position - position in local coordinates
1123311233
<key>sleep</key>
1123411234
<real>0.0</real>
1123511235
<key>tooltip</key>
11236-
<string>Converts a string, buffer, or uuid to a uuid, returns nil if invalid</string>
11236+
<string>Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID, or the the buffer is shorter than 16 bytes.</string>
1123711237
</map>
1123811238
<key>tovector</key>
1123911239
<map>
@@ -11245,7 +11245,7 @@ vector position - position in local coordinates
1124511245
<key>tooltip</key>
1124611246
<string></string>
1124711247
<key>type</key>
11248-
<string>string | vector</string>
11248+
<string>string? | vector</string>
1124911249
</map>
1125011250
</map>
1125111251
</array>
@@ -16038,18 +16038,18 @@ Returns true if result is non-zero.</string>
1603816038
<key>tooltip</key>
1603916039
<string></string>
1604016040
<key>type</key>
16041-
<string>string | buffer | uuid</string>
16041+
<string>string? | buffer | uuid</string>
1604216042
</map>
1604316043
</map>
1604416044
</array>
1604516045
<key>energy</key>
1604616046
<real>10.0</real>
1604716047
<key>return</key>
16048-
<string>uuid?</string>
16048+
<string>uuid</string>
1604916049
<key>sleep</key>
1605016050
<real>0.0</real>
1605116051
<key>tooltip</key>
16052-
<string>Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID. Throws an error if the buffer is shorter than 16 bytes. Alias of uuid.create</string>
16052+
<string>Creates a new uuid from a string, buffer, or existing uuid. Throws an error if the string is not a valid UUID, or the the buffer is shorter than 16 bytes. Alias of uuid.create.</string>
1605316053
</map>
1605416054
<key>uuid.create</key>
1605516055
<map>
@@ -16061,18 +16061,18 @@ Returns true if result is non-zero.</string>
1606116061
<key>tooltip</key>
1606216062
<string></string>
1606316063
<key>type</key>
16064-
<string>string | buffer | uuid</string>
16064+
<string>string? | buffer | uuid</string>
1606516065
</map>
1606616066
</map>
1606716067
</array>
1606816068
<key>energy</key>
1606916069
<real>10.0</real>
1607016070
<key>return</key>
16071-
<string>uuid?</string>
16071+
<string>uuid</string>
1607216072
<key>sleep</key>
1607316073
<real>0.0</real>
1607416074
<key>tooltip</key>
16075-
<string>Creates a new uuid from a string, buffer, or existing uuid. Returns nil if the string is not a valid UUID. Throws an error if the buffer is shorter than 16 bytes.</string>
16075+
<string>Creates a new uuid from a string, buffer, or existing uuid. Throws an error if the string is not a valid UUID, or the the buffer is shorter than 16 bytes.</string>
1607616076
</map>
1607716077
<key>vector</key>
1607816078
<map>

generated/slua_selene.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3925,18 +3925,24 @@ globals:
39253925
touuid:
39263926
args:
39273927
- type: string
3928-
description: Converts a string, buffer, or uuid to a uuid, returns nil if invalid
3928+
must_use: true
3929+
description: Creates a new uuid from a string, buffer, or existing uuid. Returns
3930+
nil if the string is not a valid UUID, or the the buffer is shorter than 16
3931+
bytes.
39293932
tovector:
39303933
args:
39313934
- type: string
3935+
must_use: true
39323936
description: Converts a string to a vector, returns nil if invalid
39333937
toquaternion:
39343938
args:
39353939
- type: string
3940+
must_use: true
39363941
description: Converts a string to a quaternion, returns nil if invalid
39373942
torotation:
39383943
args:
39393944
- type: string
3945+
must_use: true
39403946
description: Converts a string to a rotation (quaternion), returns nil if invalid
39413947
bit32.arshift:
39423948
args:
@@ -5062,16 +5068,16 @@ globals:
50625068
args:
50635069
- type: any
50645070
must_use: true
5065-
description: Creates a new uuid from a string, buffer, or existing uuid. Returns
5066-
nil if the string is not a valid UUID. Throws an error if the buffer is shorter
5067-
than 16 bytes. Alias of uuid.create
5071+
description: Creates a new uuid from a string, buffer, or existing uuid. Throws
5072+
an error if the string is not a valid UUID, or the the buffer is shorter than
5073+
16 bytes. Alias of uuid.create.
50685074
uuid.create:
50695075
args:
50705076
- type: any
50715077
must_use: true
5072-
description: Creates a new uuid from a string, buffer, or existing uuid. Returns
5073-
nil if the string is not a valid UUID. Throws an error if the buffer is shorter
5074-
than 16 bytes.
5078+
description: Creates a new uuid from a string, buffer, or existing uuid. Throws
5079+
an error if the string is not a valid UUID, or the the buffer is shorter than
5080+
16 bytes.
50755081
vector:
50765082
args:
50775083
- type: number

slua_definitions.yaml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -303,33 +303,39 @@ globalFunctions:
303303
type: (...any) -> ...any
304304
returnType: '...any'
305305
- name: touuid
306-
comment: Converts a string, buffer, or uuid to a uuid, returns nil if invalid
306+
comment: Creates a new uuid from a string, buffer, or existing uuid. Returns
307+
nil if the string is not a valid UUID, or the the buffer is
308+
shorter than 16 bytes.
307309
parameters:
308310
- name: val
309-
type: string | buffer | uuid
311+
type: string? | buffer | uuid
310312
selene-type: string
311313
returnType: uuid?
314+
must-use: true
312315
- name: tovector
313316
comment: Converts a string to a vector, returns nil if invalid
314317
parameters:
315318
- name: val
316-
type: string | vector
319+
type: string? | vector
317320
selene-type: string
318321
returnType: vector?
322+
must-use: true
319323
- name: toquaternion
320324
comment: Converts a string to a quaternion, returns nil if invalid
321325
parameters:
322326
- name: val
323-
type: string | quaternion
327+
type: string? | quaternion
324328
selene-type: string
325329
returnType: quaternion?
330+
must-use: true
326331
- name: torotation
327332
comment: Converts a string to a rotation (quaternion), returns nil if invalid
328333
parameters:
329334
- name: val
330-
type: string | quaternion
335+
type: string? | quaternion
331336
selene-type: string
332337
returnType: quaternion?
338+
must-use: true
333339
modules:
334340
- name: bit32
335341
comment: Bitwise operations library.
@@ -2160,23 +2166,23 @@ modules:
21602166
comment: UUID library.
21612167
callable:
21622168
name: uuid
2163-
comment: Creates a new uuid from a string, buffer, or existing uuid. Returns
2164-
nil if the string is not a valid UUID. Throws an error if the buffer is
2165-
shorter than 16 bytes. Alias of uuid.create
2169+
comment: Creates a new uuid from a string, buffer, or existing uuid. Throws
2170+
an error if the string is not a valid UUID, or the the buffer is
2171+
shorter than 16 bytes. Alias of uuid.create.
21662172
parameters:
21672173
- name: value
2168-
type: string | buffer | uuid
2169-
returnType: uuid?
2174+
type: string? | buffer | uuid
2175+
returnType: uuid
21702176
must-use: true
21712177
functions:
21722178
- name: create
2173-
comment: Creates a new uuid from a string, buffer, or existing uuid. Returns
2174-
nil if the string is not a valid UUID. Throws an error if the buffer is
2179+
comment: Creates a new uuid from a string, buffer, or existing uuid. Throws
2180+
an error if the string is not a valid UUID, or the the buffer is
21752181
shorter than 16 bytes.
21762182
parameters:
21772183
- name: value
2178-
type: string | buffer | uuid
2179-
returnType: uuid?
2184+
type: string? | buffer | uuid
2185+
returnType: uuid
21802186
must-use: true
21812187
- name: vector
21822188
comment: Vector manipuluation library.

0 commit comments

Comments
 (0)