@tilua-types/sunc 7.1.0 → 9.0.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/README.md +89 -14
- package/index.d.tilua +358 -294
- package/lowering.mjs +50 -13
- package/package.json +2 -2
- package/runtime/sunc.luau +265 -14
package/index.d.tilua
CHANGED
|
@@ -11,33 +11,35 @@
|
|
|
11
11
|
-- `RBXScriptSignal`), and `debug` here *adds* to the `debug` those libraries
|
|
12
12
|
-- declare rather than replacing it.
|
|
13
13
|
--
|
|
14
|
+
-- Every function is in a namespace by what it does — `env.getgenv()`,
|
|
15
|
+
-- `fs.read(path)`, `closure.hook(f, hook)` — and none is a global of its own.
|
|
16
|
+
-- A name the namespace already says is not said again — `fs.read`, not
|
|
17
|
+
-- `fs.readfile` — and every name is lowercase, as sUNC's are.
|
|
18
|
+
--
|
|
19
|
+
-- Nor can a script reach the executor's own globals by name: `readfile` or
|
|
20
|
+
-- `getrawmetatable` written in a script is reported, and compiles to `nil`.
|
|
21
|
+
-- The executor's environment is left as it is — `env.getgenv().readfile` is
|
|
22
|
+
-- still there, for whoever means it.
|
|
23
|
+
--
|
|
24
|
+
-- The namespaces are not the executor's: the compiler reads each from the
|
|
25
|
+
-- library's runtime (runtime/sunc.luau), which builds it as the script starts
|
|
26
|
+
-- from whatever the executor has. A function executors spell several ways is
|
|
27
|
+
-- whichever spelling there is — `http.request` is `request`, `http_request`,
|
|
28
|
+
-- `http.request` or `syn.request` — and one an executor has under none of them
|
|
29
|
+
-- is `nil`, so every member is optional and `if (fs.write)` says whether the
|
|
30
|
+
-- executor has it.
|
|
31
|
+
--
|
|
14
32
|
-- No executor implements all of this, and several names mean slightly
|
|
15
33
|
-- different things between them. Where sUNC and UNC disagree, sUNC's shape is
|
|
16
|
-
-- the one written down; where only UNC has a name (`crypt`,
|
|
17
|
-
--
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-- `queueonteleport`, ...) are declared beside it, and the names every executor
|
|
21
|
-
-- has that neither standard writes down — `decompile`, `saveinstance`, the
|
|
22
|
-
-- keyboard — are at the end.
|
|
34
|
+
-- the one written down; where only UNC has a name (`crypt`, `rconsole`, mouse
|
|
35
|
+
-- input), it is kept, since executors still expose it.
|
|
36
|
+
|
|
37
|
+
type AnyFunction = (...args: unknown[]) => unknown
|
|
23
38
|
|
|
24
39
|
-- ============================================================
|
|
25
|
-
--
|
|
40
|
+
-- env: environments and the garbage collector
|
|
26
41
|
-- ============================================================
|
|
27
42
|
|
|
28
|
-
-- The executor's own global table — shared by every script it runs.
|
|
29
|
-
declare function getgenv(): { [string]: unknown }
|
|
30
|
-
|
|
31
|
-
-- The game's global environment: the `_G` LocalScripts and ModuleScripts see.
|
|
32
|
-
declare function getrenv(): { [string]: unknown }
|
|
33
|
-
|
|
34
|
-
-- The Luau registry.
|
|
35
|
-
declare function getreg(): { [unknown]: unknown }
|
|
36
|
-
|
|
37
|
-
-- Everything the garbage collector is holding. Tables are left out unless
|
|
38
|
-
-- `includeTables` is true.
|
|
39
|
-
declare function getgc(includeTables?: boolean): (((...args: unknown[]) => unknown) | { [unknown]: unknown })[]
|
|
40
|
-
|
|
41
43
|
-- `filtergc` is `getgc` with the search done for you. The filter says what to
|
|
42
44
|
-- look for, and `returnOne` asks for the first match instead of every match —
|
|
43
45
|
-- which is what makes the return type two different things.
|
|
@@ -57,187 +59,233 @@ type TableFilter = {
|
|
|
57
59
|
Metatable?: { [unknown]: unknown },
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
declare
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
declare env: {
|
|
63
|
+
-- The executor's own global table — shared by every script it runs.
|
|
64
|
+
getgenv?: () => { [string]: unknown },
|
|
65
|
+
-- The game's global environment: the `_G` LocalScripts and ModuleScripts see.
|
|
66
|
+
getrenv?: () => { [string]: unknown },
|
|
67
|
+
-- The Luau registry.
|
|
68
|
+
getreg?: () => { [unknown]: unknown },
|
|
69
|
+
-- Everything the garbage collector is holding. Tables are left out unless
|
|
70
|
+
-- `includeTables` is true.
|
|
71
|
+
getgc?: (includeTables?: boolean) => (AnyFunction | { [unknown]: unknown })[],
|
|
72
|
+
filtergc?: ((kind: "function", filter: FunctionFilter, returnOne: true) => AnyFunction | nil)
|
|
73
|
+
& ((kind: "function", filter: FunctionFilter, returnOne?: false) => AnyFunction[])
|
|
74
|
+
& ((kind: "table", filter: TableFilter, returnOne: true) => { [unknown]: unknown } | nil)
|
|
75
|
+
& ((kind: "table", filter: TableFilter, returnOne?: false) => { [unknown]: unknown }[]),
|
|
76
|
+
}
|
|
64
77
|
|
|
65
78
|
-- ============================================================
|
|
66
|
-
--
|
|
79
|
+
-- closure: functions
|
|
67
80
|
-- ============================================================
|
|
68
81
|
|
|
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
|
-
|
|
82
|
+
declare closure: {
|
|
83
|
+
-- Replace what `func` does with `hook`, and give back a callable copy of
|
|
84
|
+
-- the original. The hook keeps the original's type, so a hooked function
|
|
85
|
+
-- is still called the way it was. (`hookfunction`, `replaceclosure`)
|
|
86
|
+
hook?: <T>(func: T, hook: AnyFunction) => T,
|
|
87
|
+
-- Undo every hook on a function, back to the one it started as. Errors if
|
|
88
|
+
-- the function was never hooked. (`restorefunction`)
|
|
89
|
+
restore?: (func: AnyFunction) => void,
|
|
90
|
+
-- A copy of `func` that is a distinct function with the same behaviour.
|
|
91
|
+
-- (`clonefunction`)
|
|
92
|
+
clone?: <T>(func: T) => T,
|
|
93
|
+
-- Wrap a Luau function so it looks and behaves like a C closure.
|
|
94
|
+
-- (`newcclosure`)
|
|
95
|
+
newcclosure?: <T>(func: T) => T,
|
|
96
|
+
-- (`iscclosure`, `islclosure`)
|
|
97
|
+
iscclosure?: (func: AnyFunction) => boolean,
|
|
98
|
+
islclosure?: (func: AnyFunction) => boolean,
|
|
99
|
+
-- Was the function made by the executor, rather than the game?
|
|
100
|
+
-- (`isexecutorclosure`, `isourclosure`, `checkclosure`)
|
|
101
|
+
isexecutorclosure?: (func: AnyFunction) => boolean,
|
|
102
|
+
-- Was the caller of the current function the executor, rather than the
|
|
103
|
+
-- game? (`checkcaller`)
|
|
104
|
+
checkcaller?: () => boolean,
|
|
105
|
+
-- A hash of a function's bytecode: two functions that do the same thing
|
|
106
|
+
-- have the same hash, which is how a hook finds its target across
|
|
107
|
+
-- updates. (`getfunctionhash`)
|
|
108
|
+
hash?: (func: AnyFunction) => string,
|
|
109
|
+
-- A function's own bytecode, as `scripts.bytecode` gives a script's.
|
|
110
|
+
-- (`getfunctionbytecode`)
|
|
111
|
+
bytecode?: (func: AnyFunction) => string,
|
|
112
|
+
}
|
|
100
113
|
|
|
101
114
|
-- ============================================================
|
|
102
|
-
--
|
|
115
|
+
-- metatable
|
|
103
116
|
-- ============================================================
|
|
104
117
|
|
|
105
|
-
declare
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
declare metatable: {
|
|
119
|
+
-- (`getrawmetatable`, `setrawmetatable`)
|
|
120
|
+
getraw?: <T>(object: T) => { [unknown]: unknown } | nil,
|
|
121
|
+
setraw?: <T>(object: T, metatable: { [unknown]: unknown } | nil) => T,
|
|
122
|
+
-- (`isreadonly`, `setreadonly`)
|
|
123
|
+
isreadonly?: (object: unknown) => boolean,
|
|
124
|
+
setreadonly?: (object: unknown, readonly: boolean) => void,
|
|
125
|
+
-- Replace one metamethod of `object`'s metatable, returning the original.
|
|
126
|
+
-- (`hookmetamethod`)
|
|
127
|
+
hook?: <T>(object: T, method: string, hook: AnyFunction) => AnyFunction,
|
|
128
|
+
-- Inside a `__namecall` hook: which method was called.
|
|
129
|
+
-- (`getnamecallmethod`)
|
|
130
|
+
getnamecallmethod?: () => string,
|
|
131
|
+
}
|
|
112
132
|
|
|
113
133
|
-- ============================================================
|
|
114
|
-
--
|
|
134
|
+
-- scripts
|
|
115
135
|
-- ============================================================
|
|
116
136
|
|
|
117
|
-
declare
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
--
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
declare scripts: {
|
|
138
|
+
-- (`getcallingscript`)
|
|
139
|
+
calling?: () => BaseScript | nil,
|
|
140
|
+
-- (`getscripts`, `getrunningscripts`, `getloadedmodules`)
|
|
141
|
+
all?: () => (LocalScript | ModuleScript)[],
|
|
142
|
+
running?: () => (LocalScript | ModuleScript)[],
|
|
143
|
+
loadedmodules?: (excludeCore?: boolean) => ModuleScript[],
|
|
144
|
+
-- (`getscriptfromthread`)
|
|
145
|
+
fromthread?: (thread: thread) => BaseScript | nil,
|
|
146
|
+
-- A script's globals, the way the script itself sees them. (`getsenv`)
|
|
147
|
+
env?: (script: LocalScript | ModuleScript) => { [string]: unknown },
|
|
148
|
+
-- (`getscriptbytecode`, `dumpstring`)
|
|
149
|
+
bytecode?: (script: LocalScript | ModuleScript) => string,
|
|
150
|
+
-- (`getscriptclosure`, `getscriptfunction`)
|
|
151
|
+
closure?: (script: LocalScript | ModuleScript) => AnyFunction,
|
|
152
|
+
-- (`getscripthash`)
|
|
153
|
+
hash?: (script: LocalScript | ModuleScript) => string,
|
|
154
|
+
-- A script's bytecode turned back into Luau source. What comes back is
|
|
155
|
+
-- the decompiler's reading of it — names of locals are gone — and on
|
|
156
|
+
-- failure it is a comment saying so rather than an error. (`decompile`)
|
|
157
|
+
decompile?: (script: LocalScript | ModuleScript | AnyFunction) => string,
|
|
158
|
+
}
|
|
139
159
|
|
|
140
160
|
-- ============================================================
|
|
141
|
-
--
|
|
161
|
+
-- identity: the current thread's permission level
|
|
142
162
|
-- ============================================================
|
|
143
163
|
|
|
144
|
-
|
|
145
|
-
--
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-- Every instance in the data model, and those parented to nil.
|
|
152
|
-
declare function getinstances(): Instance[]
|
|
153
|
-
declare function getnilinstances(): Instance[]
|
|
154
|
-
|
|
155
|
-
-- A hidden container for the executor's own UI, which the game cannot see.
|
|
156
|
-
declare function gethui(): Folder
|
|
157
|
-
|
|
158
|
-
-- Properties the engine hides from scripts: `Instance.Archivable`-style flags,
|
|
159
|
-
-- and anything marked not scriptable.
|
|
160
|
-
declare function gethiddenproperty(object: Instance, property: string): [unknown, boolean]
|
|
161
|
-
declare function sethiddenproperty(object: Instance, property: string, value: unknown): boolean
|
|
162
|
-
declare function isscriptable(object: Instance, property: string): boolean
|
|
163
|
-
declare function setscriptable(object: Instance, property: string, scriptable: boolean): boolean
|
|
164
|
+
declare identity: {
|
|
165
|
+
-- (`getthreadidentity`, `getidentity`, `getthreadcontext`)
|
|
166
|
+
get?: () => number,
|
|
167
|
+
-- (`setthreadidentity`, `setidentity`, `setthreadcontext`)
|
|
168
|
+
set?: (identity: number) => void,
|
|
169
|
+
}
|
|
164
170
|
|
|
165
|
-
--
|
|
166
|
-
|
|
171
|
+
-- ============================================================
|
|
172
|
+
-- instance
|
|
173
|
+
-- ============================================================
|
|
167
174
|
|
|
168
|
-
declare
|
|
175
|
+
declare instance: {
|
|
176
|
+
-- A reference to the same instance that the game's own code cannot
|
|
177
|
+
-- recognise as yours — what keeps a detection hook from seeing the
|
|
178
|
+
-- instance you hold. (`cloneref`)
|
|
179
|
+
cloneref?: <T>(object: T) => T,
|
|
180
|
+
-- Two references, one instance? (`compareinstances`)
|
|
181
|
+
compare?: (a: Instance, b: Instance) => boolean,
|
|
182
|
+
-- Every instance in the data model, and those parented to nil.
|
|
183
|
+
-- (`getinstances`, `getnilinstances`)
|
|
184
|
+
all?: () => Instance[],
|
|
185
|
+
nilparented?: () => Instance[],
|
|
186
|
+
-- A hidden container for the executor's own UI, which the game cannot
|
|
187
|
+
-- see. (`gethui`)
|
|
188
|
+
gethui?: () => Folder,
|
|
189
|
+
-- Properties the engine hides from scripts: `Instance.Archivable`-style
|
|
190
|
+
-- flags, and anything marked not scriptable. `gethidden` answers the value
|
|
191
|
+
-- and whether it was hidden. (`gethiddenproperty`, `sethiddenproperty`,
|
|
192
|
+
-- `isscriptable`, `setscriptable`)
|
|
193
|
+
gethidden?: (object: Instance, property: string) => [unknown, boolean],
|
|
194
|
+
sethidden?: (object: Instance, property: string, value: unknown) => boolean,
|
|
195
|
+
isscriptable?: (object: Instance, property: string) => boolean,
|
|
196
|
+
setscriptable?: (object: Instance, property: string, scriptable: boolean) => boolean,
|
|
197
|
+
-- The function assigned to a callback property (`OnServerInvoke`, ...).
|
|
198
|
+
-- (`getcallbackvalue`)
|
|
199
|
+
getcallback?: (object: Instance, property: string) => AnyFunction | nil,
|
|
200
|
+
-- (`fireclickdetector`, `fireproximityprompt`)
|
|
201
|
+
fireclickdetector?: (object: ClickDetector, distance?: number, event?: string) => void,
|
|
202
|
+
fireproximityprompt?: (prompt: ProximityPrompt) => void,
|
|
203
|
+
-- `toggle` is true (or 0) to begin the touch and false (or 1) to end it.
|
|
204
|
+
-- (`firetouchinterest`)
|
|
205
|
+
firetouch?: (part: BasePart, other: BasePart, toggle: boolean | number) => void,
|
|
206
|
+
-- `game:GetObjects`, which a script may not call itself. (`getobjects`)
|
|
207
|
+
getobjects?: (assetId: string) => Instance[],
|
|
208
|
+
-- Does this client simulate the part's physics? (`isnetworkowner`)
|
|
209
|
+
isnetworkowner?: (part: BasePart) => boolean,
|
|
210
|
+
-- Write the place, or one instance and what is under it, to a file in the
|
|
211
|
+
-- workspace folder. The options are the executor's own (`mode`,
|
|
212
|
+
-- `noscripts`, `FilePath`, ...), so they are left open. (`saveinstance`)
|
|
213
|
+
save?: (target?: Instance | { [string]: unknown }, options?: { [string]: unknown }) => void,
|
|
214
|
+
}
|
|
169
215
|
|
|
170
216
|
declare cache: {
|
|
171
217
|
-- Forget an instance, so the next reference to it is a new one.
|
|
172
|
-
invalidate
|
|
218
|
+
invalidate?: (object: Instance) => void,
|
|
173
219
|
-- Point every future reference to `object` at `newObject` instead.
|
|
174
|
-
replace
|
|
175
|
-
|
|
220
|
+
replace?: (object: Instance, newObject: Instance) => void,
|
|
221
|
+
-- (`cache.iscached`)
|
|
222
|
+
iscached?: (object: Instance) => boolean,
|
|
176
223
|
}
|
|
177
224
|
|
|
178
225
|
-- ============================================================
|
|
179
|
-
--
|
|
226
|
+
-- signal
|
|
180
227
|
-- ============================================================
|
|
181
228
|
|
|
182
229
|
-- One connection of a signal. `Function` and `Thread` are nil for connections
|
|
183
230
|
-- the engine made itself.
|
|
184
231
|
type Connection = {
|
|
185
|
-
Function:
|
|
232
|
+
Function: AnyFunction | nil,
|
|
186
233
|
Thread: thread | nil,
|
|
187
234
|
Enabled: boolean,
|
|
188
235
|
ForeignState: boolean,
|
|
189
236
|
LuaConnection: boolean,
|
|
190
|
-
Fire: (self: Connection, ...args: unknown[]) =>
|
|
191
|
-
Defer: (self: Connection, ...args: unknown[]) =>
|
|
192
|
-
Disconnect: (self: Connection) =>
|
|
193
|
-
Disable: (self: Connection) =>
|
|
194
|
-
Enable: (self: Connection) =>
|
|
237
|
+
Fire: (self: Connection, ...args: unknown[]) => void,
|
|
238
|
+
Defer: (self: Connection, ...args: unknown[]) => void,
|
|
239
|
+
Disconnect: (self: Connection) => void,
|
|
240
|
+
Disable: (self: Connection) => void,
|
|
241
|
+
Enable: (self: Connection) => void,
|
|
195
242
|
}
|
|
196
243
|
|
|
197
244
|
-- Any signal at all. Written as the shape every signal has rather than as
|
|
198
245
|
-- `RBXScriptSignal<T>`, because a signal's type carries the arguments of its
|
|
199
246
|
-- own event, as a tuple, and these functions do not care which event it is.
|
|
200
|
-
type AnySignal = { Connect: (self: unknown, callback: (...args: unknown[]) =>
|
|
201
|
-
|
|
202
|
-
declare
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
-- Send a signal to the server, for the signals that replicate.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
declare function fireproximityprompt(prompt: ProximityPrompt): nil
|
|
212
|
-
|
|
213
|
-
-- `toggle` is true (or 0) to begin the touch and false (or 1) to end it.
|
|
214
|
-
declare function firetouchinterest(part: BasePart, other: BasePart, toggle: boolean | number): nil
|
|
247
|
+
type AnySignal = { Connect: (self: unknown, callback: (...args: unknown[]) => void) => RBXScriptConnection }
|
|
248
|
+
|
|
249
|
+
declare signal: {
|
|
250
|
+
-- (`getconnections`)
|
|
251
|
+
connections?: (signal: AnySignal) => Connection[],
|
|
252
|
+
-- Run every Luau connection of a signal now. (`firesignal`)
|
|
253
|
+
fire?: (signal: AnySignal, ...args: unknown[]) => void,
|
|
254
|
+
-- Send a signal to the server, for the signals that replicate.
|
|
255
|
+
-- (`replicatesignal`)
|
|
256
|
+
replicate?: (signal: AnySignal, ...args: unknown[]) => void,
|
|
257
|
+
}
|
|
215
258
|
|
|
216
259
|
-- ============================================================
|
|
217
|
-
--
|
|
260
|
+
-- fs: the executor's workspace folder
|
|
218
261
|
-- ============================================================
|
|
219
262
|
--
|
|
220
263
|
-- Paths are relative to the executor's own workspace folder.
|
|
221
264
|
|
|
222
|
-
declare
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
--
|
|
237
|
-
|
|
265
|
+
declare fs: {
|
|
266
|
+
-- (`readfile`, `writefile`, `appendfile`, `delfile`, `isfile`, `listfiles`)
|
|
267
|
+
read?: (path: string) => string,
|
|
268
|
+
write?: (path: string, data: string) => void,
|
|
269
|
+
append?: (path: string, data: string) => void,
|
|
270
|
+
delete?: (path: string) => void,
|
|
271
|
+
isfile?: (path: string) => boolean,
|
|
272
|
+
list?: (path: string) => string[],
|
|
273
|
+
-- (`makefolder`, `delfolder`, `isfolder`)
|
|
274
|
+
makefolder?: (path: string) => void,
|
|
275
|
+
deletefolder?: (path: string) => void,
|
|
276
|
+
isfolder?: (path: string) => boolean,
|
|
277
|
+
-- Run a file. (`dofile`)
|
|
278
|
+
dofile?: (path: string) => void,
|
|
279
|
+
-- Compile a file without running it, as `loadstring` does a string.
|
|
280
|
+
-- (`loadfile`)
|
|
281
|
+
loadfile?: (path: string, chunkname?: string) => [AnyFunction | nil, string | nil],
|
|
282
|
+
-- A `rbxasset://` id for a file on disk, usable wherever the engine takes
|
|
283
|
+
-- a content id (images, sounds, meshes). (`getcustomasset`)
|
|
284
|
+
getcustomasset?: (path: string, noCache?: boolean) => string,
|
|
285
|
+
}
|
|
238
286
|
|
|
239
287
|
-- ============================================================
|
|
240
|
-
--
|
|
288
|
+
-- http, websocket
|
|
241
289
|
-- ============================================================
|
|
242
290
|
|
|
243
291
|
type HttpRequest = {
|
|
@@ -256,62 +304,94 @@ type HttpResponse = {
|
|
|
256
304
|
Headers: { [string]: string },
|
|
257
305
|
}
|
|
258
306
|
|
|
259
|
-
--
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
307
|
+
-- What a body can hold that a Luau table cannot: a key whose value is nil.
|
|
308
|
+
-- Each stands in for one in a body built by `http.request(types => ...)`, and
|
|
309
|
+
-- is written as what it says as the request goes out.
|
|
310
|
+
type HttpPlaceholder = { readonly __httpPlaceholder: true }
|
|
311
|
+
type HttpTypes = {
|
|
312
|
+
-- JSON's `null`: the key is sent, with no value.
|
|
313
|
+
readonly null: HttpPlaceholder,
|
|
314
|
+
-- Not sent at all, as JavaScript's `undefined`: left out of an object,
|
|
315
|
+
-- and `null` in an array, where leaving it out would move the rest.
|
|
316
|
+
readonly undefined: HttpPlaceholder,
|
|
264
317
|
}
|
|
265
318
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
base64_decode: (data: string) => string,
|
|
277
|
-
base64: { encode: (data: string) => string, decode: (data: string) => string },
|
|
278
|
-
encrypt: (data: string, key: string, iv?: string, mode?: string) => [string, string],
|
|
279
|
-
decrypt: (data: string, key: string, iv: string, mode: string) => string,
|
|
280
|
-
hash: (data: string, algorithm: string) => string,
|
|
281
|
-
generatebytes: (size: number) => string,
|
|
282
|
-
generatekey: () => string,
|
|
319
|
+
-- A request built by a function. `Body` may be the value itself, sent as JSON
|
|
320
|
+
-- — `[]` an array and `{}` an object, as `HttpService:JSONEncode` writes them
|
|
321
|
+
-- under tilua, and with `Content-Type: application/json` unless the headers
|
|
322
|
+
-- say otherwise — or a string, sent as it is.
|
|
323
|
+
type HttpBuiltRequest = {
|
|
324
|
+
Url: string,
|
|
325
|
+
Method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | "OPTIONS",
|
|
326
|
+
Body?: string | { [string]: unknown } | unknown[],
|
|
327
|
+
Headers?: { [string]: string },
|
|
328
|
+
Cookies?: { [string]: string },
|
|
283
329
|
}
|
|
284
330
|
|
|
285
|
-
declare
|
|
286
|
-
|
|
287
|
-
|
|
331
|
+
declare http: {
|
|
332
|
+
-- Yields until the response arrives. Given a function, calls it with the
|
|
333
|
+
-- placeholders and sends the request it builds:
|
|
334
|
+
--
|
|
335
|
+
-- http.request(types => ({
|
|
336
|
+
-- Url: url, Method: "POST",
|
|
337
|
+
-- Body: { name: "x", team: types.null, tags: [] },
|
|
338
|
+
-- }))
|
|
339
|
+
--
|
|
340
|
+
-- (`request`, `http_request`, `http.request`, `syn.request`, `fluxus.request`)
|
|
341
|
+
request?: ((options: HttpRequest) => HttpResponse)
|
|
342
|
+
& ((build: (types: HttpTypes) => HttpBuiltRequest) => HttpResponse),
|
|
288
343
|
}
|
|
289
344
|
|
|
290
345
|
type WebSocketConnection = {
|
|
291
|
-
Send: (self: WebSocketConnection, message: string) =>
|
|
292
|
-
Close: (self: WebSocketConnection) =>
|
|
346
|
+
Send: (self: WebSocketConnection, message: string) => void,
|
|
347
|
+
Close: (self: WebSocketConnection) => void,
|
|
293
348
|
OnMessage: RBXScriptSignal<[string]>,
|
|
294
349
|
OnClose: RBXScriptSignal<[]>,
|
|
295
350
|
}
|
|
296
351
|
|
|
297
|
-
declare
|
|
298
|
-
|
|
352
|
+
declare websocket: {
|
|
353
|
+
-- (`WebSocket.connect`)
|
|
354
|
+
connect?: (url: string) => WebSocketConnection,
|
|
299
355
|
}
|
|
300
356
|
|
|
301
357
|
-- ============================================================
|
|
302
|
-
--
|
|
358
|
+
-- encoding, crypt
|
|
359
|
+
-- ============================================================
|
|
360
|
+
|
|
361
|
+
declare encoding: {
|
|
362
|
+
-- (`base64encode`, `crypt.base64encode`, `crypt.base64_encode`,
|
|
363
|
+
-- `crypt.base64.encode`, `base64.encode`, and the same for decode)
|
|
364
|
+
base64encode?: (data: string) => string,
|
|
365
|
+
base64decode?: (data: string) => string,
|
|
366
|
+
-- (`lz4compress`, `lz4decompress`)
|
|
367
|
+
lz4compress?: (data: string) => string,
|
|
368
|
+
lz4decompress?: (data: string, size: number) => string,
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
declare crypt: {
|
|
372
|
+
-- The ciphertext and the iv it used.
|
|
373
|
+
encrypt?: (data: string, key: string, iv?: string, mode?: string) => [string, string],
|
|
374
|
+
decrypt?: (data: string, key: string, iv: string, mode: string) => string,
|
|
375
|
+
hash?: (data: string, algorithm: string) => string,
|
|
376
|
+
-- (`crypt.generatebytes`, `crypt.generatekey`)
|
|
377
|
+
generatebytes?: (size: number) => string,
|
|
378
|
+
generatekey?: () => string,
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
-- ============================================================
|
|
382
|
+
-- drawing
|
|
303
383
|
-- ============================================================
|
|
304
384
|
--
|
|
305
|
-
-- Shapes drawn above the game window. `
|
|
306
|
-
-- argument names, so `
|
|
307
|
-
-- `
|
|
385
|
+
-- Shapes drawn above the game window. `drawing.new` gives back the type its
|
|
386
|
+
-- argument names, so `drawing.new("Circle").Radius` is a number and
|
|
387
|
+
-- `drawing.new("Line").Radius` is an error.
|
|
308
388
|
|
|
309
389
|
type BaseDrawing = {
|
|
310
390
|
Visible: boolean,
|
|
311
391
|
ZIndex: number,
|
|
312
392
|
Transparency: number,
|
|
313
393
|
Color: Color3,
|
|
314
|
-
Destroy: (self: BaseDrawing) =>
|
|
394
|
+
Destroy: (self: BaseDrawing) => void,
|
|
315
395
|
}
|
|
316
396
|
|
|
317
397
|
type DrawingLine = BaseDrawing & { From: Vector2, To: Vector2, Thickness: number }
|
|
@@ -342,74 +422,74 @@ type DrawingTriangle = BaseDrawing & {
|
|
|
342
422
|
type Drawing = DrawingLine | DrawingText | DrawingImage | DrawingCircle
|
|
343
423
|
| DrawingSquare | DrawingQuad | DrawingTriangle
|
|
344
424
|
|
|
345
|
-
declare
|
|
346
|
-
|
|
425
|
+
declare drawing: {
|
|
426
|
+
-- (`Drawing.new`)
|
|
427
|
+
new?: ((kind: "Line") => DrawingLine)
|
|
347
428
|
& ((kind: "Text") => DrawingText)
|
|
348
429
|
& ((kind: "Image") => DrawingImage)
|
|
349
430
|
& ((kind: "Circle") => DrawingCircle)
|
|
350
431
|
& ((kind: "Square") => DrawingSquare)
|
|
351
432
|
& ((kind: "Quad") => DrawingQuad)
|
|
352
433
|
& ((kind: "Triangle") => DrawingTriangle),
|
|
353
|
-
Fonts
|
|
434
|
+
-- (`Drawing.Fonts`)
|
|
435
|
+
fonts?: { UI: number, System: number, Plex: number, Monospace: number },
|
|
436
|
+
-- Destroy every drawing at once; references to them stop working.
|
|
437
|
+
-- (`cleardrawcache`)
|
|
438
|
+
clear?: () => void,
|
|
439
|
+
-- (`getrenderproperty`, `setrenderproperty`, `isrenderobj`)
|
|
440
|
+
getproperty?: (drawing: Drawing, property: string) => unknown,
|
|
441
|
+
setproperty?: (drawing: Drawing, property: string, value: unknown) => void,
|
|
442
|
+
isdrawing?: (object: unknown) => boolean,
|
|
354
443
|
}
|
|
355
444
|
|
|
356
|
-
-- Destroy every drawing at once; references to them stop working.
|
|
357
|
-
declare function cleardrawcache(): nil
|
|
358
|
-
|
|
359
|
-
declare function getrenderproperty(drawing: Drawing, property: string): unknown
|
|
360
|
-
declare function setrenderproperty(drawing: Drawing, property: string, value: unknown): nil
|
|
361
|
-
declare function isrenderobj(object: unknown): boolean
|
|
362
|
-
|
|
363
445
|
-- ============================================================
|
|
364
|
-
--
|
|
446
|
+
-- rconsole: the executor's own console window
|
|
365
447
|
-- ============================================================
|
|
366
448
|
|
|
367
|
-
declare
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
declare function consoledestroy(): nil
|
|
378
|
-
declare function consoleclear(): nil
|
|
379
|
-
declare function consoleprint(text: string): nil
|
|
380
|
-
declare function consolesettitle(title: string): nil
|
|
381
|
-
declare function consoleinput(): string
|
|
449
|
+
declare rconsole: {
|
|
450
|
+
-- (`rconsolecreate` ... `rconsoleinput`, and the same without the `r`;
|
|
451
|
+
-- `rconsolename` for `settitle`)
|
|
452
|
+
create?: () => void,
|
|
453
|
+
destroy?: () => void,
|
|
454
|
+
clear?: () => void,
|
|
455
|
+
print?: (text: string) => void,
|
|
456
|
+
settitle?: (title: string) => void,
|
|
457
|
+
input?: () => string,
|
|
458
|
+
}
|
|
382
459
|
|
|
383
460
|
-- ============================================================
|
|
384
|
-
--
|
|
461
|
+
-- input: real mouse and keyboard events
|
|
385
462
|
-- ============================================================
|
|
386
463
|
--
|
|
387
|
-
--
|
|
388
|
-
--
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
464
|
+
-- Delivered to the window. They do nothing while the Roblox window is not the
|
|
465
|
+
-- active one — `input.isactive` says whether it is.
|
|
466
|
+
|
|
467
|
+
declare input: {
|
|
468
|
+
-- (`isrbxactive`, `isgameactive`)
|
|
469
|
+
isactive?: () => boolean,
|
|
470
|
+
-- (`mouse1click`, `mouse1press`, ...)
|
|
471
|
+
mouse1click?: () => void,
|
|
472
|
+
mouse1press?: () => void,
|
|
473
|
+
mouse1release?: () => void,
|
|
474
|
+
mouse2click?: () => void,
|
|
475
|
+
mouse2press?: () => void,
|
|
476
|
+
mouse2release?: () => void,
|
|
477
|
+
-- (`mousemoveabs`, `mousemoverel`, `mousescroll`)
|
|
478
|
+
mousemoveabs?: (x: number, y: number) => void,
|
|
479
|
+
mousemoverel?: (x: number, y: number) => void,
|
|
480
|
+
mousescroll?: (pixels: number) => void,
|
|
481
|
+
-- Keys are Windows virtual-key codes (`0x57` is W), not `Enum.KeyCode`.
|
|
482
|
+
-- (`keypress`, `keyrelease`, `keyclick`)
|
|
483
|
+
keypress?: (key: number) => void,
|
|
484
|
+
keyrelease?: (key: number) => void,
|
|
485
|
+
keyclick?: (key: number) => void,
|
|
486
|
+
}
|
|
407
487
|
|
|
408
488
|
-- ============================================================
|
|
409
|
-
--
|
|
489
|
+
-- debug
|
|
410
490
|
-- ============================================================
|
|
411
491
|
--
|
|
412
|
-
-- These add to
|
|
492
|
+
-- These add to Lua's own `debug`, which is already a global: the executor
|
|
413
493
|
-- reaches into a function's own bytecode. Each takes a function, or a stack
|
|
414
494
|
-- level counted from the caller.
|
|
415
495
|
|
|
@@ -418,7 +498,7 @@ declare function keyclick(key: number): nil
|
|
|
418
498
|
type DebugInfo = {
|
|
419
499
|
source: string,
|
|
420
500
|
short_src: string,
|
|
421
|
-
func:
|
|
501
|
+
func: AnyFunction,
|
|
422
502
|
what: "Lua" | "C",
|
|
423
503
|
currentline: number,
|
|
424
504
|
name: string,
|
|
@@ -428,69 +508,53 @@ type DebugInfo = {
|
|
|
428
508
|
}
|
|
429
509
|
|
|
430
510
|
declare debug: {
|
|
431
|
-
getinfo: (func:
|
|
432
|
-
getconstant: (func:
|
|
433
|
-
getconstants: (func:
|
|
434
|
-
setconstant: (func:
|
|
435
|
-
getupvalue: (func:
|
|
436
|
-
getupvalues: (func:
|
|
437
|
-
setupvalue: (func:
|
|
438
|
-
getproto: (func:
|
|
439
|
-
|
|
440
|
-
getprotos: (func: ((...args: unknown[]) => unknown) | number) => ((...args: unknown[]) => unknown)[],
|
|
511
|
+
getinfo: (func: AnyFunction | number) => DebugInfo,
|
|
512
|
+
getconstant: (func: AnyFunction | number, index: number) => unknown,
|
|
513
|
+
getconstants: (func: AnyFunction | number) => unknown[],
|
|
514
|
+
setconstant: (func: AnyFunction | number, index: number, value: unknown) => void,
|
|
515
|
+
getupvalue: (func: AnyFunction | number, index: number) => unknown,
|
|
516
|
+
getupvalues: (func: AnyFunction | number) => unknown[],
|
|
517
|
+
setupvalue: (func: AnyFunction | number, index: number, value: unknown) => void,
|
|
518
|
+
getproto: (func: AnyFunction | number, index: number, active?: boolean) => AnyFunction | AnyFunction[],
|
|
519
|
+
getprotos: (func: AnyFunction | number) => AnyFunction[],
|
|
441
520
|
getstack: (level: number, index?: number) => unknown,
|
|
442
|
-
setstack: (level: number, index: number, value: unknown) =>
|
|
521
|
+
setstack: (level: number, index: number, value: unknown) => void,
|
|
443
522
|
}
|
|
444
523
|
|
|
445
524
|
-- ============================================================
|
|
446
|
-
--
|
|
525
|
+
-- executor, clipboard, teleport, actor
|
|
447
526
|
-- ============================================================
|
|
448
527
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
declare function queue_on_teleport(code: string): nil
|
|
461
|
-
declare function queueonteleport(code: string): nil
|
|
462
|
-
|
|
463
|
-
-- ============================================================
|
|
464
|
-
-- Beyond the standards
|
|
465
|
-
-- ============================================================
|
|
466
|
-
--
|
|
467
|
-
-- In neither sUNC nor UNC, and in nearly every executor all the same. With no
|
|
468
|
-
-- standard to follow, the shapes are the ones executors agree on.
|
|
469
|
-
|
|
470
|
-
-- A script's bytecode turned back into Luau source. What comes back is the
|
|
471
|
-
-- decompiler's reading of it — names of locals are gone — and on failure it is
|
|
472
|
-
-- a comment saying so rather than an error.
|
|
473
|
-
declare function decompile(script: LocalScript | ModuleScript | ((...args: unknown[]) => unknown)): string
|
|
474
|
-
|
|
475
|
-
-- A function's own bytecode, as `getscriptbytecode` gives a script's.
|
|
476
|
-
declare function getfunctionbytecode(func: (...args: unknown[]) => unknown): string
|
|
477
|
-
|
|
478
|
-
-- Write the place, or one instance and what is under it, to a file in the
|
|
479
|
-
-- workspace folder. The options are the executor's own (`mode`, `noscripts`,
|
|
480
|
-
-- `FilePath`, ...), so they are left open.
|
|
481
|
-
declare function saveinstance(target?: Instance | { [string]: unknown }, options?: { [string]: unknown }): nil
|
|
482
|
-
|
|
483
|
-
-- `game:GetObjects`, which a script may not call itself.
|
|
484
|
-
declare function getobjects(assetId: string): Instance[]
|
|
528
|
+
declare executor: {
|
|
529
|
+
-- The executor's name and version. (`identifyexecutor`, `getexecutorname`)
|
|
530
|
+
identify?: () => [string, string],
|
|
531
|
+
-- An id for the machine the executor runs on. (`gethwid`)
|
|
532
|
+
hwid?: () => string,
|
|
533
|
+
-- (`setfpscap`, `getfpscap`)
|
|
534
|
+
setfpscap?: (fps: number) => void,
|
|
535
|
+
getfpscap?: () => number,
|
|
536
|
+
-- (`messagebox`)
|
|
537
|
+
messagebox?: (text: string, caption: string, flags: number) => number,
|
|
538
|
+
}
|
|
485
539
|
|
|
486
|
-
|
|
487
|
-
|
|
540
|
+
declare clipboard: {
|
|
541
|
+
-- (`setclipboard`, `toclipboard`)
|
|
542
|
+
set?: (text: string) => void,
|
|
543
|
+
-- Roblox Studio's clipboard, of instances. (`setrbxclipboard`)
|
|
544
|
+
setrbx?: (data: string) => boolean,
|
|
545
|
+
}
|
|
488
546
|
|
|
489
|
-
|
|
490
|
-
|
|
547
|
+
declare teleport: {
|
|
548
|
+
-- Source to run after the next teleport, in the new place.
|
|
549
|
+
-- (`queue_on_teleport`, `queueonteleport`, `queueteleport`)
|
|
550
|
+
queue?: (code: string) => void,
|
|
551
|
+
}
|
|
491
552
|
|
|
492
553
|
-- Parallel Luau: the actors of the game, and code run inside one — each actor
|
|
493
554
|
-- is a Luau state of its own, which a script outside cannot reach.
|
|
494
|
-
declare
|
|
495
|
-
|
|
496
|
-
|
|
555
|
+
declare actor: {
|
|
556
|
+
-- (`getactors`, `run_on_actor`, `isparallel`)
|
|
557
|
+
all?: () => Actor[],
|
|
558
|
+
run?: (actor: Actor, code: string, ...args: unknown[]) => void,
|
|
559
|
+
isparallel?: () => boolean,
|
|
560
|
+
}
|