@tilua-types/roblox 3.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.tilua +183 -181
- package/package.json +2 -2
package/index.d.tilua
CHANGED
|
@@ -21,187 +21,189 @@
|
|
|
21
21
|
-- ...), copied from scripts/luau.d.tilua — Luau is Roblox's, so they ship
|
|
22
22
|
-- together. The Lua 5.1 standard library underneath is `@tilua-types/lua`.
|
|
23
23
|
|
|
24
|
-
-- What Luau adds to Lua 5.1.
|
|
25
|
-
--
|
|
26
|
-
-- This file is hand-written and is copied verbatim into the head of
|
|
27
|
-
-- packages/roblox/index.d.tilua by generate-roblox.mjs: Luau is Roblox's, so
|
|
28
|
-
-- the two ship as one library rather than two. `@tilua-types/lua` underneath has the
|
|
29
|
-
-- standard library this builds on, and a name declared in both keeps what Lua
|
|
30
|
-
-- gave it — declarations merge, overloads accumulate — so `table` here is
|
|
31
|
-
-- Lua's `table` plus these members.
|
|
32
|
-
--
|
|
33
|
-
-- Edit this file, then regenerate the Roblox definitions.
|
|
34
|
-
|
|
35
|
-
-- ============================================================
|
|
36
|
-
-- `typeof()`
|
|
37
|
-
-- ------------------------------------------------------------
|
|
38
|
-
-- Luau's own: `type()`'s answers plus the Roblox data types further down this
|
|
39
|
-
-- file, which it reports by name rather than as `userdata`. Narrowing works
|
|
40
|
-
-- exactly as it does for `type()` — see `@tilua-types/lua` for how the overloads
|
|
41
|
-
-- drive it.
|
|
42
|
-
-- ============================================================
|
|
43
|
-
|
|
44
|
-
declare function typeof(value: nil): "nil"
|
|
45
|
-
declare function typeof(value: boolean): "boolean"
|
|
46
|
-
declare function typeof(value: number): "number"
|
|
47
|
-
declare function typeof(value: string): "string"
|
|
48
|
-
declare function typeof(value: thread): "thread"
|
|
49
|
-
declare function typeof(value: buffer): "buffer"
|
|
50
|
-
declare function typeof(value: (...args: unknown[]) => unknown): "function"
|
|
51
|
-
declare function typeof(value: { [unknown]: unknown }): "table"
|
|
52
|
-
declare function typeof<T>(value: T): string
|
|
53
|
-
|
|
54
|
-
-- Luau's `type()` knows one answer Lua's does not.
|
|
55
|
-
declare function type(value: buffer): "buffer"
|
|
56
|
-
|
|
57
|
-
-- ============================================================
|
|
58
|
-
-- Base library
|
|
59
|
-
-- ============================================================
|
|
60
|
-
|
|
61
|
-
-- Not Lua's, but every Luau host provides it.
|
|
62
|
-
declare function warn(...args: unknown[]): nil
|
|
63
|
-
declare function rawlen(t: unknown): number
|
|
64
|
-
|
|
65
|
-
declare debug: {
|
|
66
|
-
info: (...args: unknown[]) => unknown,
|
|
67
|
-
profilebegin: (label: string) => nil,
|
|
68
|
-
profileend: () => nil,
|
|
69
|
-
setmemorycategory: (tag: string) => nil,
|
|
70
|
-
resetmemorycategory: () => nil,
|
|
71
|
-
dumpcodesize: () => nil,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
declare string: {
|
|
75
|
-
split: (s: string, separator?: string) => string[],
|
|
76
|
-
-- Binary packing, from Lua 5.3. `unpack` answers the values it read and
|
|
77
|
-
-- then the position it stopped at, as one array.
|
|
78
|
-
pack: (format: string, ...args: unknown[]) => string,
|
|
79
|
-
packsize: (format: string) => number,
|
|
80
|
-
unpack: (format: string, data: string, pos?: number) => [...unknown[]],
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
-- And a string answers to it: `text:split(",")`.
|
|
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
|
-
create
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-- `for (const [
|
|
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
|
-
|
|
24
|
+
-- What Luau adds to Lua 5.1.
|
|
25
|
+
--
|
|
26
|
+
-- This file is hand-written and is copied verbatim into the head of
|
|
27
|
+
-- packages/roblox/index.d.tilua by generate-roblox.mjs: Luau is Roblox's, so
|
|
28
|
+
-- the two ship as one library rather than two. `@tilua-types/lua` underneath has the
|
|
29
|
+
-- standard library this builds on, and a name declared in both keeps what Lua
|
|
30
|
+
-- gave it — declarations merge, overloads accumulate — so `table` here is
|
|
31
|
+
-- Lua's `table` plus these members.
|
|
32
|
+
--
|
|
33
|
+
-- Edit this file, then regenerate the Roblox definitions.
|
|
34
|
+
|
|
35
|
+
-- ============================================================
|
|
36
|
+
-- `typeof()`
|
|
37
|
+
-- ------------------------------------------------------------
|
|
38
|
+
-- Luau's own: `type()`'s answers plus the Roblox data types further down this
|
|
39
|
+
-- file, which it reports by name rather than as `userdata`. Narrowing works
|
|
40
|
+
-- exactly as it does for `type()` — see `@tilua-types/lua` for how the overloads
|
|
41
|
+
-- drive it.
|
|
42
|
+
-- ============================================================
|
|
43
|
+
|
|
44
|
+
declare function typeof(value: nil): "nil"
|
|
45
|
+
declare function typeof(value: boolean): "boolean"
|
|
46
|
+
declare function typeof(value: number): "number"
|
|
47
|
+
declare function typeof(value: string): "string"
|
|
48
|
+
declare function typeof(value: thread): "thread"
|
|
49
|
+
declare function typeof(value: buffer): "buffer"
|
|
50
|
+
declare function typeof(value: (...args: unknown[]) => unknown): "function"
|
|
51
|
+
declare function typeof(value: { [unknown]: unknown }): "table"
|
|
52
|
+
declare function typeof<T>(value: T): string
|
|
53
|
+
|
|
54
|
+
-- Luau's `type()` knows one answer Lua's does not.
|
|
55
|
+
declare function type(value: buffer): "buffer"
|
|
56
|
+
|
|
57
|
+
-- ============================================================
|
|
58
|
+
-- Base library
|
|
59
|
+
-- ============================================================
|
|
60
|
+
|
|
61
|
+
-- Not Lua's, but every Luau host provides it.
|
|
62
|
+
declare function warn(...args: unknown[]): nil
|
|
63
|
+
declare function rawlen(t: unknown): number
|
|
64
|
+
|
|
65
|
+
declare debug: {
|
|
66
|
+
info: (...args: unknown[]) => unknown,
|
|
67
|
+
profilebegin: (label: string) => nil,
|
|
68
|
+
profileend: () => nil,
|
|
69
|
+
setmemorycategory: (tag: string) => nil,
|
|
70
|
+
resetmemorycategory: () => nil,
|
|
71
|
+
dumpcodesize: () => nil,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare string: {
|
|
75
|
+
split: (s: string, separator?: string) => string[],
|
|
76
|
+
-- Binary packing, from Lua 5.3. `unpack` answers the values it read and
|
|
77
|
+
-- then the position it stopped at, as one array.
|
|
78
|
+
pack: (format: string, ...args: unknown[]) => string,
|
|
79
|
+
packsize: (format: string) => number,
|
|
80
|
+
unpack: (format: string, data: string, pos?: number) => [...unknown[]],
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
-- And a string answers to it: `text:split(",")`. Luau's string metatable
|
|
84
|
+
-- has it, so it is added to the language's, and stays a plain method call.
|
|
85
|
+
declare metatable string: {
|
|
86
|
+
__index: {
|
|
87
|
+
split: (self: string, separator?: string) => string[],
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare math: {
|
|
92
|
+
clamp: (x: number, min: number, max: number) => number,
|
|
93
|
+
round: (x: number) => number,
|
|
94
|
+
sign: (x: number) => number,
|
|
95
|
+
-- Perlin noise; the unwritten coordinates are 0.
|
|
96
|
+
noise: (x: number, y?: number, z?: number) => number,
|
|
97
|
+
lerp: (a: number, b: number, t: number) => number,
|
|
98
|
+
map: (x: number, inmin: number, inmax: number, outmin: number, outmax: number) => number,
|
|
99
|
+
isnan: (n: number) => boolean,
|
|
100
|
+
isinf: (n: number) => boolean,
|
|
101
|
+
isfinite: (n: number) => boolean,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare table: {
|
|
105
|
+
find: <T>(t: T[], value: T, init?: number) => number | nil,
|
|
106
|
+
clear: (t: unknown) => nil,
|
|
107
|
+
clone: <T>(t: T) => T,
|
|
108
|
+
freeze: <T>(t: T) => T,
|
|
109
|
+
isfrozen: (t: unknown) => boolean,
|
|
110
|
+
-- `create(n)` with no value fills with nil, and `T` is whatever the
|
|
111
|
+
-- annotation on the left says.
|
|
112
|
+
create: <T>(count: number, value?: T) => T[],
|
|
113
|
+
pack: (...args: unknown[]) => { n: number, [number]: unknown },
|
|
114
|
+
unpack: <T>(list: T[], i?: number, j?: number) => [...T[]],
|
|
115
|
+
move: <T>(src: T[], a: number, b: number, t: number, dst?: T[]) => T[],
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare coroutine: {
|
|
119
|
+
isyieldable: () => boolean,
|
|
120
|
+
-- Closes a suspended coroutine: `[true]`, or `[false, error]`.
|
|
121
|
+
close: (co: thread) => [boolean, unknown],
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare utf8: {
|
|
125
|
+
char: (...args: number[]) => string,
|
|
126
|
+
codepoint: (s: string, i?: number, j?: number) => [...number[]],
|
|
127
|
+
len: (s: string, i?: number, j?: number) => number | nil,
|
|
128
|
+
offset: (s: string, n: number, i?: number) => number | nil,
|
|
129
|
+
nfdnormalize: (s: string) => string,
|
|
130
|
+
nfcnormalize: (s: string) => string,
|
|
131
|
+
-- `for (const [position, code] in utf8.codes(s))`.
|
|
132
|
+
codes: (s: string) => Iteration<string, [number, number]>,
|
|
133
|
+
-- `for (const [first, last] in utf8.graphemes(s))`: where each grapheme
|
|
134
|
+
-- cluster starts and ends, as byte positions.
|
|
135
|
+
graphemes: (s: string, i?: number, j?: number) => () => [number, number] | nil,
|
|
136
|
+
charpattern: string,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare bit32: {
|
|
140
|
+
band: (...args: number[]) => number,
|
|
141
|
+
bor: (...args: number[]) => number,
|
|
142
|
+
bxor: (...args: number[]) => number,
|
|
143
|
+
bnot: (x: number) => number,
|
|
144
|
+
-- True when the bitwise AND of its arguments is not zero.
|
|
145
|
+
btest: (...args: number[]) => boolean,
|
|
146
|
+
lshift: (x: number, disp: number) => number,
|
|
147
|
+
rshift: (x: number, disp: number) => number,
|
|
148
|
+
arshift: (x: number, disp: number) => number,
|
|
149
|
+
extract: (n: number, field: number, width?: number) => number,
|
|
150
|
+
replace: (n: number, v: number, field: number, width?: number) => number,
|
|
151
|
+
countlz: (n: number) => number,
|
|
152
|
+
countrz: (n: number) => number,
|
|
153
|
+
lrotate: (x: number, disp: number) => number,
|
|
154
|
+
rrotate: (x: number, disp: number) => number,
|
|
155
|
+
byteswap: (n: number) => number,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare buffer: {
|
|
159
|
+
create: (size: number) => buffer,
|
|
160
|
+
fromstring: (s: string) => buffer,
|
|
161
|
+
tostring: (b: buffer) => string,
|
|
162
|
+
len: (b: buffer) => number,
|
|
163
|
+
readi8: (b: buffer, offset: number) => number,
|
|
164
|
+
readu8: (b: buffer, offset: number) => number,
|
|
165
|
+
readi16: (b: buffer, offset: number) => number,
|
|
166
|
+
readu16: (b: buffer, offset: number) => number,
|
|
167
|
+
readi32: (b: buffer, offset: number) => number,
|
|
168
|
+
readu32: (b: buffer, offset: number) => number,
|
|
169
|
+
readf32: (b: buffer, offset: number) => number,
|
|
170
|
+
readf64: (b: buffer, offset: number) => number,
|
|
171
|
+
readbits: (b: buffer, bitOffset: number, bitCount: number) => number,
|
|
172
|
+
readstring: (b: buffer, offset: number, count: number) => string,
|
|
173
|
+
writei8: (b: buffer, offset: number, value: number) => nil,
|
|
174
|
+
writeu8: (b: buffer, offset: number, value: number) => nil,
|
|
175
|
+
writei16: (b: buffer, offset: number, value: number) => nil,
|
|
176
|
+
writeu16: (b: buffer, offset: number, value: number) => nil,
|
|
177
|
+
writei32: (b: buffer, offset: number, value: number) => nil,
|
|
178
|
+
writeu32: (b: buffer, offset: number, value: number) => nil,
|
|
179
|
+
writef32: (b: buffer, offset: number, value: number) => nil,
|
|
180
|
+
writef64: (b: buffer, offset: number, value: number) => nil,
|
|
181
|
+
writebits: (b: buffer, bitOffset: number, bitCount: number, value: number) => nil,
|
|
182
|
+
writestring: (b: buffer, offset: number, value: string, count?: number) => nil,
|
|
183
|
+
copy: (dst: buffer, dstOffset: number, src: buffer, srcOffset?: number, count?: number) => nil,
|
|
184
|
+
fill: (b: buffer, offset: number, value: number, count?: number) => nil,
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
-- Luau's own vector library. In Roblox a vector *is* a `Vector3` — the same
|
|
188
|
+
-- value, and what every engine API that takes one expects — so that is what
|
|
189
|
+
-- these are typed as, rather than an opaque type nothing else would accept.
|
|
190
|
+
declare vector: {
|
|
191
|
+
create: (x: number, y: number, z: number) => Vector3,
|
|
192
|
+
magnitude: (vec: Vector3) => number,
|
|
193
|
+
normalize: (vec: Vector3) => Vector3,
|
|
194
|
+
cross: (vec1: Vector3, vec2: Vector3) => Vector3,
|
|
195
|
+
dot: (vec1: Vector3, vec2: Vector3) => number,
|
|
196
|
+
angle: (vec1: Vector3, vec2: Vector3, axis?: Vector3) => number,
|
|
197
|
+
floor: (vec: Vector3) => Vector3,
|
|
198
|
+
ceil: (vec: Vector3) => Vector3,
|
|
199
|
+
abs: (vec: Vector3) => Vector3,
|
|
200
|
+
sign: (vec: Vector3) => Vector3,
|
|
201
|
+
clamp: (vec: Vector3, min: Vector3, max: Vector3) => Vector3,
|
|
202
|
+
lerp: (vec1: Vector3, vec2: Vector3, alpha: number) => Vector3,
|
|
203
|
+
max: (...args: Vector3[]) => Vector3,
|
|
204
|
+
min: (...args: Vector3[]) => Vector3,
|
|
205
|
+
zero: Vector3,
|
|
206
|
+
one: Vector3,
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
type ContentId = string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tilua-types/roblox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Luau and the whole Roblox API as tilua types: every class, enum, data type, service and global",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lowering": "lowering.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@tilua-types/lua": "^
|
|
18
|
+
"@tilua-types/lua": "^4.0.0"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"tilua",
|