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