@defold-typescript/types 0.39.0 → 0.41.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/api-availability.json +4024 -716
- package/api-migrations.json +27 -0
- package/api-signatures.json +18118 -10264
- package/api-targets.json +448 -11
- package/examples/translations.json +619 -148
- package/fixtures/messages_doc.json +96 -0
- package/generated/b2d.d.ts +680 -4
- package/generated/b2d_body.d.ts +29 -103
- package/generated/b2d_chain.d.ts +5 -6
- package/generated/b2d_fixture.d.ts +34 -38
- package/generated/b2d_joint.d.ts +503 -25
- package/generated/b2d_shape.d.ts +199 -14
- package/generated/b2d_world.d.ts +57 -63
- package/generated/buffer.d.ts +33 -29
- package/generated/builtin-messages.d.ts +7 -1
- package/generated/bullet3d.d.ts +91 -0
- package/generated/bullet3d_collision_object.d.ts +433 -0
- package/generated/bullet3d_constraint.d.ts +818 -0
- package/generated/bullet3d_rigid_body.d.ts +429 -0
- package/generated/bullet3d_shape.d.ts +123 -0
- package/generated/bullet3d_world.d.ts +492 -0
- package/generated/camera.d.ts +31 -34
- package/generated/collectionfactory.d.ts +26 -27
- package/generated/collectionproxy.d.ts +22 -6
- package/generated/compute.d.ts +12 -238
- package/generated/crash.d.ts +24 -10
- package/generated/editor-vm/http.d.ts +90 -7
- package/generated/editor-vm/image.d.ts +7 -7
- package/generated/editor-vm/json.d.ts +11 -0
- package/generated/editor-vm/localization.d.ts +7 -7
- package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
- package/generated/editor-vm/zip.d.ts +28 -0
- package/generated/editor.d.ts +1496 -430
- package/generated/factory.d.ts +21 -25
- package/generated/font.d.ts +64 -22
- package/generated/go.d.ts +243 -186
- package/generated/graphics.d.ts +374 -84
- package/generated/gui.d.ts +282 -492
- package/generated/html5.d.ts +5 -3
- package/generated/http.d.ts +31 -36
- package/generated/image.d.ts +127 -85
- package/generated/json.d.ts +34 -16
- package/generated/kinds/gui-script.d.ts +8 -0
- package/generated/kinds/render-script.d.ts +8 -0
- package/generated/kinds/script.d.ts +8 -0
- package/generated/label.d.ts +77 -7
- package/generated/liveupdate.d.ts +13 -10
- package/generated/material.d.ts +312 -360
- package/generated/model.d.ts +72 -42
- package/generated/particlefx.d.ts +19 -28
- package/generated/physics.d.ts +378 -144
- package/generated/profiler.d.ts +14 -24
- package/generated/render.d.ts +294 -297
- package/generated/resource.d.ts +753 -641
- package/generated/socket.d.ts +131 -134
- package/generated/sound.d.ts +65 -34
- package/generated/sprite.d.ts +39 -17
- package/generated/sys.d.ts +237 -182
- package/generated/tilemap.d.ts +21 -16
- package/generated/timer.d.ts +34 -21
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
- package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
- package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
- package/generated/versions/defold-1.12.4/go.d.ts +15 -17
- package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
- package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
- package/generated/versions/defold-1.12.4/http.d.ts +4 -15
- package/generated/versions/defold-1.12.4/image.d.ts +38 -46
- package/generated/versions/defold-1.12.4/index.d.ts +2 -0
- package/generated/versions/defold-1.12.4/json.d.ts +10 -6
- package/generated/versions/defold-1.12.4/label.d.ts +2 -3
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
- package/generated/versions/defold-1.12.4/model.d.ts +34 -13
- package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
- package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
- package/generated/versions/defold-1.12.4/render.d.ts +160 -132
- package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
- package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
- package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
- package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
- package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
- package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
- package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
- package/generated/versions/defold-1.12.4/window.d.ts +1 -16
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
- package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
- package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
- package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
- package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
- package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
- package/generated/versions/defold-1.13.0/go.d.ts +15 -17
- package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
- package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
- package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
- package/generated/versions/defold-1.13.0/http.d.ts +4 -15
- package/generated/versions/defold-1.13.0/image.d.ts +38 -46
- package/generated/versions/defold-1.13.0/index.d.ts +2 -0
- package/generated/versions/defold-1.13.0/json.d.ts +10 -6
- package/generated/versions/defold-1.13.0/label.d.ts +2 -3
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
- package/generated/versions/defold-1.13.0/material.d.ts +69 -107
- package/generated/versions/defold-1.13.0/model.d.ts +34 -13
- package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
- package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
- package/generated/versions/defold-1.13.0/render.d.ts +160 -132
- package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
- package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
- package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
- package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
- package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
- package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
- package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
- package/generated/versions/defold-1.13.0/window.d.ts +1 -16
- package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
- package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
- package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
- package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
- package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
- package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
- package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
- package/generated/versions/defold-1.13.1/font.d.ts +81 -0
- package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
- package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
- package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.1/http.d.ts +77 -0
- package/generated/versions/defold-1.13.1/image.d.ts +131 -0
- package/generated/versions/defold-1.13.1/index.d.ts +57 -0
- package/generated/versions/defold-1.13.1/json.d.ts +80 -0
- package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.1/label.d.ts +93 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
- package/generated/versions/defold-1.13.1/material.d.ts +408 -0
- package/generated/versions/defold-1.13.1/model.d.ts +272 -0
- package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
- package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
- package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
- package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
- package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
- package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
- package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
- package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
- package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
- package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
- package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
- package/generated/versions/defold-1.13.1/types.d.ts +61 -0
- package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
- package/generated/versions/defold-1.13.1/window.d.ts +183 -0
- package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
- package/generated/vmath.d.ts +6 -26
- package/generated/window.d.ts +71 -71
- package/identity-vocabulary.json +561 -0
- package/index.d.ts +8 -0
- package/package.json +13 -2
- package/scripts/example-store-io.ts +12 -1
- package/scripts/extension-goldens.ts +1 -0
- package/scripts/fidelity-baseline.json +146 -46
- package/scripts/generate-api-availability.ts +90 -12
- package/scripts/generate-api-signatures.ts +14 -3
- package/scripts/import-defold-release.ts +85 -24
- package/scripts/prose-constants.ts +157 -0
- package/scripts/regen.ts +396 -78
- package/scripts/shared-handle-methods.ts +53 -0
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +16 -5
- package/src/api-availability.ts +0 -0
- package/src/api-doc.ts +201 -3
- package/src/api-identity.ts +252 -0
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +28 -3
- package/src/correction-pins.ts +49 -0
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +139 -23
- package/src/doc-corrections.ts +108 -0
- package/src/editor-vm-globals.d.ts +5 -2
- package/src/emit-dts.ts +2474 -281
- package/src/emit-messages.ts +52 -0
- package/src/engine-globals.d.ts +2 -2
- package/src/example-store.ts +125 -14
- package/src/field-correction-coverage.ts +204 -0
- package/src/fnv1a.ts +16 -0
- package/src/go-overloads.d.ts +33 -13
- package/src/index-base-table.ts +145 -0
- package/src/index-slot-classifications.ts +588 -0
- package/src/index.ts +39 -2
- package/src/library-index-slot-classifications.ts +332 -0
- package/src/lifecycle.ts +61 -199
- package/src/luals-type-expr.ts +354 -0
- package/src/msg-overloads.d.ts +0 -1
- package/src/param-correction-provenance.ts +64 -0
- package/src/return-correction-provenance.ts +58 -16
- package/src/script-api.ts +3 -1
- package/src/sys-overloads.d.ts +48 -0
- package/src/vmath-overloads.d.ts +27 -1
- package/src/window-event-guard.d.ts +6 -9
- package/url-parameters.json +1 -2
|
@@ -17,7 +17,7 @@ declare global {
|
|
|
17
17
|
* require "builtins.scripts.socket"
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* LuaSocket is Copyright
|
|
20
|
+
* LuaSocket is Copyright © 2004-2007 Diego Nehab. All rights reserved.
|
|
21
21
|
* LuaSocket is free software, released under the MIT license (same license as the Lua core).
|
|
22
22
|
*/
|
|
23
23
|
namespace socket {
|
|
@@ -47,11 +47,8 @@ declare global {
|
|
|
47
47
|
* @param option - the name of the option to get:
|
|
48
48
|
*
|
|
49
49
|
* - `"keepalive"`
|
|
50
|
-
*
|
|
51
50
|
* - `"linger"`
|
|
52
|
-
*
|
|
53
51
|
* - `"reuseaddr"`
|
|
54
|
-
*
|
|
55
52
|
* - `"tcp-nodelay"`
|
|
56
53
|
*/
|
|
57
54
|
getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
|
|
@@ -94,8 +91,12 @@ declare global {
|
|
|
94
91
|
* Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the `..` operator) and send the result in one call instead of calling the method several times.
|
|
95
92
|
*
|
|
96
93
|
* @param data - the string to be sent.
|
|
97
|
-
* @param i - optional starting index of the string.
|
|
98
|
-
* @param j - optional end index of string.
|
|
94
|
+
* @param i - optional starting index of the string. **⚠️ 1-based; passed to Defold unchanged.**
|
|
95
|
+
* @param j - optional end index of string. **⚠️ 1-based; passed to Defold unchanged.**
|
|
96
|
+
* @returns `[index, error, lastindex]`:
|
|
97
|
+
* - `index` — the index of the last byte within [i, j] that has been sent, or `nil` in case of error. Notice that, if `i` is 1 or absent, this is effectively the total number of bytes sent. **⚠️ 1-based; passed to Defold unchanged.**
|
|
98
|
+
* - `error` — the error message, or `nil` if no error occurred. The error message can be `"closed"` in case the connection was closed before the transmission was completed or the string `"timeout"` in case there was a timeout during the operation.
|
|
99
|
+
* - `lastindex` — in case of error, the index of the last byte within [i, j] that has been sent. You might want to try again from the byte following that. `nil` if no error occurred. **⚠️ 1-based; passed to Defold unchanged.**
|
|
99
100
|
*/
|
|
100
101
|
send(data: string, i?: number, j?: number): LuaMultiReturn<[number | undefined, string | undefined, number | undefined]>;
|
|
101
102
|
/**
|
|
@@ -115,7 +116,6 @@ declare global {
|
|
|
115
116
|
* Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
|
|
116
117
|
*
|
|
117
118
|
* - boolean `on`
|
|
118
|
-
*
|
|
119
119
|
* - number `timeout` (seconds)
|
|
120
120
|
*
|
|
121
121
|
* If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
|
|
@@ -179,23 +179,14 @@ declare global {
|
|
|
179
179
|
* @param option - the name of the option to get:
|
|
180
180
|
*
|
|
181
181
|
* - `"dontroute"`
|
|
182
|
-
*
|
|
183
182
|
* - `"broadcast"`
|
|
184
|
-
*
|
|
185
183
|
* - `"reuseaddr"`
|
|
186
|
-
*
|
|
187
184
|
* - `"reuseport"`
|
|
188
|
-
*
|
|
189
185
|
* - `"ip-multicast-loop"`
|
|
190
|
-
*
|
|
191
186
|
* - `"ipv6-v6only"`
|
|
192
|
-
*
|
|
193
187
|
* - `"ip-multicast-if"`
|
|
194
|
-
*
|
|
195
188
|
* - `"ip-multicast-ttl"`
|
|
196
|
-
*
|
|
197
189
|
* - `"ip-add-membership"`
|
|
198
|
-
*
|
|
199
190
|
* - `"ip-drop-membership"`
|
|
200
191
|
*/
|
|
201
192
|
getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
|
|
@@ -251,14 +242,12 @@ declare global {
|
|
|
251
242
|
* `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
|
|
252
243
|
*
|
|
253
244
|
* - string `multiaddr` (IP address)
|
|
254
|
-
*
|
|
255
245
|
* - string `interface` (IP address)
|
|
256
246
|
*
|
|
257
247
|
* "'ip-drop-membership"`
|
|
258
248
|
* Leaves the multicast group specified. Receives a table with fields:
|
|
259
249
|
*
|
|
260
250
|
* - string `multiaddr` (IP address)
|
|
261
|
-
*
|
|
262
251
|
* - string `interface` (IP address)
|
|
263
252
|
* @param value - the value to set for the specified option.
|
|
264
253
|
*/
|
|
@@ -393,11 +382,8 @@ declare global {
|
|
|
393
382
|
* @param option - the name of the option to get:
|
|
394
383
|
*
|
|
395
384
|
* - `"keepalive"`
|
|
396
|
-
*
|
|
397
385
|
* - `"linger"`
|
|
398
|
-
*
|
|
399
386
|
* - `"reuseaddr"`
|
|
400
|
-
*
|
|
401
387
|
* - `"tcp-nodelay"`
|
|
402
388
|
*/
|
|
403
389
|
getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
|
|
@@ -430,7 +416,6 @@ declare global {
|
|
|
430
416
|
* Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
|
|
431
417
|
*
|
|
432
418
|
* - boolean `on`
|
|
433
|
-
*
|
|
434
419
|
* - number `timeout` (seconds)
|
|
435
420
|
*
|
|
436
421
|
* If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
|
|
@@ -480,23 +465,14 @@ declare global {
|
|
|
480
465
|
* @param option - the name of the option to get:
|
|
481
466
|
*
|
|
482
467
|
* - `"dontroute"`
|
|
483
|
-
*
|
|
484
468
|
* - `"broadcast"`
|
|
485
|
-
*
|
|
486
469
|
* - `"reuseaddr"`
|
|
487
|
-
*
|
|
488
470
|
* - `"reuseport"`
|
|
489
|
-
*
|
|
490
471
|
* - `"ip-multicast-loop"`
|
|
491
|
-
*
|
|
492
472
|
* - `"ipv6-v6only"`
|
|
493
|
-
*
|
|
494
473
|
* - `"ip-multicast-if"`
|
|
495
|
-
*
|
|
496
474
|
* - `"ip-multicast-ttl"`
|
|
497
|
-
*
|
|
498
475
|
* - `"ip-add-membership"`
|
|
499
|
-
*
|
|
500
476
|
* - `"ip-drop-membership"`
|
|
501
477
|
*/
|
|
502
478
|
getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
|
|
@@ -553,14 +529,12 @@ declare global {
|
|
|
553
529
|
* `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
|
|
554
530
|
*
|
|
555
531
|
* - string `multiaddr` (IP address)
|
|
556
|
-
*
|
|
557
532
|
* - string `interface` (IP address)
|
|
558
533
|
*
|
|
559
534
|
* "'ip-drop-membership"`
|
|
560
535
|
* Leaves the multicast group specified. Receives a table with fields:
|
|
561
536
|
*
|
|
562
537
|
* - string `multiaddr` (IP address)
|
|
563
|
-
*
|
|
564
538
|
* - string `interface` (IP address)
|
|
565
539
|
* @param value - the value to set for the specified option.
|
|
566
540
|
*/
|
|
@@ -640,15 +614,18 @@ declare global {
|
|
|
640
614
|
* // create a try function that closes 'c' on error
|
|
641
615
|
* const try_ = socket.newtry(() => c.close());
|
|
642
616
|
* // do everything reassured c will be closed
|
|
643
|
-
*
|
|
644
|
-
*
|
|
617
|
+
* const [sent, sendError, lastByte] = c.send("hello there?\r\n");
|
|
618
|
+
* try_(sent, sendError, lastByte);
|
|
619
|
+
* const [line, receiveError, partial] = c.receive();
|
|
620
|
+
* const answer = try_(line, receiveError, partial);
|
|
645
621
|
* // ...
|
|
646
|
-
*
|
|
622
|
+
* const [byeSent, byeError, byeLastByte] = c.send("good bye\r\n");
|
|
623
|
+
* try_(byeSent, byeError, byeLastByte);
|
|
647
624
|
* c.close();
|
|
648
625
|
* }
|
|
649
626
|
* ```
|
|
650
627
|
*/
|
|
651
|
-
function newtry(finalizer
|
|
628
|
+
function newtry(finalizer?: () => void): <T>(value: T | undefined, ...rest: T extends { readonly __tstlMultiReturn: unknown } ? [boxedMultiReturn: never] : unknown[]) => T;
|
|
652
629
|
/**
|
|
653
630
|
* Converts a function that throws exceptions into a safe function. This function only catches exceptions thrown by try functions. It does not catch normal Lua errors.
|
|
654
631
|
* Beware that if your function performs some illegal operation that raises an error, the protected function will catch the error and return it as a string. This is because try functions uses errors as the mechanism to throw exceptions.
|
|
@@ -659,17 +636,20 @@ declare global {
|
|
|
659
636
|
* ```ts
|
|
660
637
|
* const dostuff = socket.protect(() => {
|
|
661
638
|
* let try_ = socket.newtry();
|
|
662
|
-
* const
|
|
639
|
+
* const [conn, connectError] = socket.connect("myserver.com", 80);
|
|
640
|
+
* const c = try_(conn, connectError);
|
|
663
641
|
* try_ = socket.newtry(() => c.close());
|
|
664
|
-
*
|
|
665
|
-
*
|
|
642
|
+
* const [sent, sendError, lastByte] = c.send("hello?\r\n");
|
|
643
|
+
* try_(sent, sendError, lastByte);
|
|
644
|
+
* const [line, receiveError, partial] = c.receive();
|
|
645
|
+
* const answer = try_(line, receiveError, partial);
|
|
666
646
|
* c.close();
|
|
667
647
|
* });
|
|
668
648
|
*
|
|
669
649
|
* const [n, error] = dostuff();
|
|
670
650
|
* ```
|
|
671
651
|
*/
|
|
672
|
-
function protect(func: (...args: unknown[]) => unknown): (
|
|
652
|
+
function protect(func: (...args: unknown[]) => unknown): (...args: unknown[]) => LuaMultiReturn<[unknown, string | undefined]>;
|
|
673
653
|
/**
|
|
674
654
|
* The function returns a list with the sockets ready for reading, a list with the sockets ready for writing and an error message. The error message is "timeout" if a timeout condition was met and nil otherwise. The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.
|
|
675
655
|
* `Recvt` and `sendt` parameters can be empty tables or `nil`. Non-socket values (or values with non-numeric indices) in these arrays will be silently ignored.
|
|
@@ -696,14 +676,16 @@ declare global {
|
|
|
696
676
|
* @param ret2 - argument 2.
|
|
697
677
|
* @param retN - argument N.
|
|
698
678
|
* @example
|
|
679
|
+
* Instead of doing the following with dummy variables:
|
|
699
680
|
* ```ts
|
|
700
681
|
* const line = "250 OK";
|
|
701
|
-
*
|
|
702
|
-
* // Instead of doing the following with dummy variables:
|
|
703
682
|
* // get the status code and separator from SMTP server reply
|
|
704
683
|
* const [dummy1, dummy2, code, sep] = string.find(line, "^(%d%d%d)(.?)");
|
|
705
|
-
*
|
|
706
|
-
*
|
|
684
|
+
* ```
|
|
685
|
+
* @example
|
|
686
|
+
* You can skip a number of variables:
|
|
687
|
+
* ```ts
|
|
688
|
+
* const line = "250 OK";
|
|
707
689
|
* // get the status code and separator from SMTP server reply
|
|
708
690
|
* const [code, sep] = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"));
|
|
709
691
|
* ```
|
|
@@ -739,18 +721,19 @@ declare global {
|
|
|
739
721
|
* The supplied address can be an IPv4 or IPv6 address or host name.
|
|
740
722
|
* The function returns a table with all information returned by the resolver:
|
|
741
723
|
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
724
|
+
* ```lua
|
|
725
|
+
* {
|
|
726
|
+
* [1] = {
|
|
727
|
+
* family = family-name-1,
|
|
728
|
+
* addr = address-1
|
|
729
|
+
* },
|
|
730
|
+
* ...
|
|
731
|
+
* [n] = {
|
|
732
|
+
* family = family-name-n,
|
|
733
|
+
* addr = address-n
|
|
734
|
+
* }
|
|
752
735
|
* }
|
|
753
|
-
*
|
|
736
|
+
* ```
|
|
754
737
|
*
|
|
755
738
|
* Here, family contains the string `"inet"` for IPv4 addresses, and `"inet6"` for IPv6 addresses.
|
|
756
739
|
* In case of error, the function returns nil followed by an error message.
|
|
@@ -769,12 +752,13 @@ declare global {
|
|
|
769
752
|
* The supplied address can be an IPv4 or IPv6 address or host name.
|
|
770
753
|
* The function returns a table with all information returned by the resolver:
|
|
771
754
|
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
755
|
+
* ```lua
|
|
756
|
+
* {
|
|
757
|
+
* [1] = host-name-1,
|
|
758
|
+
* ...
|
|
759
|
+
* [n] = host-name-n,
|
|
776
760
|
* }
|
|
777
|
-
*
|
|
761
|
+
* ```
|
|
778
762
|
*
|
|
779
763
|
* @param address - a hostname or an IPv4 or IPv6 address.
|
|
780
764
|
*/
|
|
@@ -38,7 +38,7 @@ declare global {
|
|
|
38
38
|
* }
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
function get_group_name(group:
|
|
41
|
+
function get_group_name(group: Hash): string;
|
|
42
42
|
/**
|
|
43
43
|
* Get a table of all mixer group names (hashes).
|
|
44
44
|
*
|
|
@@ -83,7 +83,7 @@ declare global {
|
|
|
83
83
|
* square root of the mean (average) value of the squared function of
|
|
84
84
|
* the instantaneous values.
|
|
85
85
|
* For instance: for a sinewave signal with a peak gain of -1.94 dB (0.8 linear),
|
|
86
|
-
* the RMS is `0.8
|
|
86
|
+
* the RMS is `0.8 × 1/sqrt(2)` which is about 0.566.
|
|
87
87
|
* Note the returned value might be an approximation and in particular
|
|
88
88
|
* the effective window might be larger than specified.
|
|
89
89
|
*
|
|
@@ -108,7 +108,6 @@ declare global {
|
|
|
108
108
|
* The best time to call this function is:
|
|
109
109
|
*
|
|
110
110
|
* - In the `init` function of your main collection script before any sounds are triggered
|
|
111
|
-
*
|
|
112
111
|
* - In a window listener callback when the window.WINDOW_EVENT_FOCUS_GAINED event is received
|
|
113
112
|
*
|
|
114
113
|
* Both those times will give you a correct reading of the state even when your application is
|
|
@@ -187,12 +186,13 @@ declare global {
|
|
|
187
186
|
* url The invoker of the callback: the sound component.
|
|
188
187
|
* @returns The identifier for the sound voice
|
|
189
188
|
* @example
|
|
189
|
+
* Assuming the script belongs to an instance with a sound-component with id "sound", this will make the component play its sound after 1 second:
|
|
190
190
|
* ```ts
|
|
191
|
-
* // Assuming the script belongs to an instance with a sound-component with id
|
|
192
|
-
* // "sound", this will make the component play its sound after 1 second:
|
|
193
191
|
* sound.play("#sound", { delay: 1, gain: 0.9, pan: -1.0 });
|
|
194
|
-
*
|
|
195
|
-
*
|
|
192
|
+
* ```
|
|
193
|
+
* @example
|
|
194
|
+
* Using the callback argument, you can chain several sounds together:
|
|
195
|
+
* ```ts
|
|
196
196
|
* function sound_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
197
197
|
* // play 'boom' sound fx when the countdown has completed
|
|
198
198
|
* const { play_id } = message as { play_id: number };
|
|
@@ -202,8 +202,8 @@ declare global {
|
|
|
202
202
|
* }
|
|
203
203
|
*
|
|
204
204
|
* export default defineScript({
|
|
205
|
-
* init(
|
|
206
|
-
*
|
|
205
|
+
* init() {
|
|
206
|
+
* return { countdown_id: sound.play("#countdown", undefined, sound_done) };
|
|
207
207
|
* },
|
|
208
208
|
* });
|
|
209
209
|
* ```
|
|
@@ -221,7 +221,7 @@ declare global {
|
|
|
221
221
|
* sound.set_gain("#sound", 0.9);
|
|
222
222
|
* ```
|
|
223
223
|
*/
|
|
224
|
-
function set_gain(url: string | Hash | Url, gain
|
|
224
|
+
function set_gain(url: string | Hash | Url, gain: number): void;
|
|
225
225
|
/**
|
|
226
226
|
* Set mixer group gain
|
|
227
227
|
*
|
|
@@ -247,7 +247,7 @@ declare global {
|
|
|
247
247
|
* sound.set_pan("#sound", 0.5); // pan to the right
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
|
-
function set_pan(url: string | Hash | Url, pan
|
|
250
|
+
function set_pan(url: string | Hash | Url, pan: number): void;
|
|
251
251
|
/**
|
|
252
252
|
* Stop playing all active voices or just one voice if `play_id` provided
|
|
253
253
|
*
|
|
@@ -24,7 +24,6 @@ declare global {
|
|
|
24
24
|
* table Information about the completion:
|
|
25
25
|
*
|
|
26
26
|
* - number `current_tile` - the current tile of the sprite.
|
|
27
|
-
*
|
|
28
27
|
* - hash `id` - id of the animation that was completed.
|
|
29
28
|
*
|
|
30
29
|
* `sender`
|
|
@@ -36,9 +35,20 @@ declare global {
|
|
|
36
35
|
* `playback_rate`
|
|
37
36
|
* number the rate with which the animation will be played. Must be positive.
|
|
38
37
|
* @example
|
|
38
|
+
* The following examples assumes that the model has id "sprite".
|
|
39
|
+
* How to play the "jump" animation followed by the "run" animation:
|
|
40
|
+
* ```ts
|
|
41
|
+
* const url = msg.url("#sprite");
|
|
42
|
+
*
|
|
43
|
+
* function anim_done(self: unknown, message_id: Hash, message: { id: Hash }) {
|
|
44
|
+
* if (message_id === hash("animation_done") && message.id === hash("jump")) {
|
|
45
|
+
* // jump animation done, chain with "run"
|
|
46
|
+
* sprite.play_flipbook(url, "run");
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
* @example
|
|
39
51
|
* ```ts
|
|
40
|
-
* // Assuming the sprite has id "sprite": play the "jump" animation followed by the
|
|
41
|
-
* // "run" animation:
|
|
42
52
|
* export default defineScript({
|
|
43
53
|
* init() {
|
|
44
54
|
* const url = msg.url("#sprite");
|
|
@@ -52,7 +62,7 @@ declare global {
|
|
|
52
62
|
* });
|
|
53
63
|
* ```
|
|
54
64
|
*/
|
|
55
|
-
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id:
|
|
65
|
+
function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void, play_properties?: { offset?: number; playback_rate?: number }): void;
|
|
56
66
|
/**
|
|
57
67
|
* Sets horizontal flipping of the provided sprite's animations.
|
|
58
68
|
* The sprite is identified by its URL.
|
|
@@ -65,6 +75,10 @@ declare global {
|
|
|
65
75
|
* // How to flip a sprite so it faces the horizontal movement (it is assumed that
|
|
66
76
|
* // the sprite component has id "sprite" and the original animation faces right):
|
|
67
77
|
* export default defineScript({
|
|
78
|
+
* init() {
|
|
79
|
+
* return { velocity: vmath.vector3() };
|
|
80
|
+
* },
|
|
81
|
+
*
|
|
68
82
|
* update(self, dt) {
|
|
69
83
|
* // calculate self.velocity somehow
|
|
70
84
|
* sprite.set_hflip("#sprite", self.velocity.x < 0);
|
|
@@ -86,6 +100,10 @@ declare global {
|
|
|
86
100
|
* // assumed that the sprite component has id "sprite" and the original animation
|
|
87
101
|
* // is up-right):
|
|
88
102
|
* export default defineScript({
|
|
103
|
+
* init() {
|
|
104
|
+
* return { up_side_down: false };
|
|
105
|
+
* },
|
|
106
|
+
*
|
|
89
107
|
* update(self, dt) {
|
|
90
108
|
* // calculate self.up_side_down somehow, then:
|
|
91
109
|
* sprite.set_vflip("#sprite", self.up_side_down);
|
|
@@ -98,7 +116,7 @@ declare global {
|
|
|
98
116
|
/**
|
|
99
117
|
* READ ONLY The current animation id. An animation that plays currently for the sprite. The type of the property is hash.
|
|
100
118
|
*/
|
|
101
|
-
animation: Hash;
|
|
119
|
+
readonly animation: Hash;
|
|
102
120
|
/**
|
|
103
121
|
* The normalized animation cursor. The type of the property is number.
|
|
104
122
|
*/
|
|
@@ -106,7 +124,7 @@ declare global {
|
|
|
106
124
|
/**
|
|
107
125
|
* READ ONLY The frame count of the currently playing animation.
|
|
108
126
|
*/
|
|
109
|
-
frame_count: number;
|
|
127
|
+
readonly frame_count: number;
|
|
110
128
|
/**
|
|
111
129
|
* The image used when rendering the sprite. The type of the property is hash.
|
|
112
130
|
*/
|
|
@@ -55,11 +55,12 @@ declare global {
|
|
|
55
55
|
* @example
|
|
56
56
|
* ```ts
|
|
57
57
|
* // Load data but return nil if path didn't exist
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* function load_data(path: string) {
|
|
59
|
+
* if (!sys.exists(path)) {
|
|
60
|
+
* return undefined;
|
|
61
|
+
* }
|
|
62
|
+
* return sys.load(path); // returns {} if it failed
|
|
61
63
|
* }
|
|
62
|
-
* return sys.load(path); // returns {} if it failed
|
|
63
64
|
* ```
|
|
64
65
|
*/
|
|
65
66
|
function exists(path: string): boolean;
|
|
@@ -94,10 +95,10 @@ declare global {
|
|
|
94
95
|
* `installed`
|
|
95
96
|
* boolean `true` if the application is installed, `false` otherwise.
|
|
96
97
|
* @example
|
|
98
|
+
* Check if twitter is installed:
|
|
97
99
|
* ```ts
|
|
98
|
-
* // Check if twitter is installed:
|
|
99
100
|
* const sysinfo = sys.get_sys_info();
|
|
100
|
-
* let twitter = {};
|
|
101
|
+
* let twitter: { installed?: boolean } = {};
|
|
101
102
|
*
|
|
102
103
|
* if (sysinfo.system_name === "Android") {
|
|
103
104
|
* twitter = sys.get_application_info("com.twitter.android");
|
|
@@ -108,8 +109,10 @@ declare global {
|
|
|
108
109
|
* if (twitter.installed) {
|
|
109
110
|
* // twitter is installed!
|
|
110
111
|
* }
|
|
111
|
-
*
|
|
112
|
-
*
|
|
112
|
+
* ```
|
|
113
|
+
* @example
|
|
114
|
+
* Info.plist for the iOS app needs to list the schemes that are queried:
|
|
115
|
+
* ```ts
|
|
113
116
|
* // ...
|
|
114
117
|
* // <key>LSApplicationQueriesSchemes</key>
|
|
115
118
|
* // <array>
|
|
@@ -168,10 +171,12 @@ declare global {
|
|
|
168
171
|
* @param default_value - (optional) default value to return if the value does not exist
|
|
169
172
|
* @returns config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
|
|
170
173
|
* @example
|
|
174
|
+
* Get user config value
|
|
171
175
|
* ```ts
|
|
172
|
-
* // Get user config value
|
|
173
176
|
* const speed = sys.get_config_int("my_game.speed", 20); // with default value
|
|
174
|
-
*
|
|
177
|
+
* ```
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
175
180
|
* const testmode = sys.get_config_int("my_game.testmode"); // without default value
|
|
176
181
|
* if (testmode !== undefined) {
|
|
177
182
|
* // do stuff
|
|
@@ -192,25 +197,6 @@ declare global {
|
|
|
192
197
|
* ```
|
|
193
198
|
*/
|
|
194
199
|
function get_config_number(key: string, default_value?: number): number;
|
|
195
|
-
/**
|
|
196
|
-
* Get string config value from the game.project configuration file with optional default value
|
|
197
|
-
*
|
|
198
|
-
* @param key - key to get value for. The syntax is SECTION.KEY
|
|
199
|
-
* @param default_value - (optional) default value to return if the value does not exist
|
|
200
|
-
* @returns config value as a string. default_value if the config key does not exist. nil if no default value was supplied.
|
|
201
|
-
* @example
|
|
202
|
-
* ```ts
|
|
203
|
-
* // Get user config value
|
|
204
|
-
* const text = sys.get_config_string("my_game.text", "default text");
|
|
205
|
-
*
|
|
206
|
-
* // Start the engine with a bootstrap config override and add a custom config value
|
|
207
|
-
* // $ dmengine --config=bootstrap.main_collection=/mytest.collectionc --config=mygame.testmode=1
|
|
208
|
-
*
|
|
209
|
-
* // Read the custom config value from the command line
|
|
210
|
-
* const testmode = sys.get_config_int("mygame.testmode");
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
function get_config_string(key: string, default_value?: string): string;
|
|
214
200
|
/**
|
|
215
201
|
* Returns the current network connectivity status
|
|
216
202
|
* on mobile platforms.
|
|
@@ -219,9 +205,7 @@ declare global {
|
|
|
219
205
|
* @returns network connectivity status:
|
|
220
206
|
*
|
|
221
207
|
* - `sys.NETWORK_DISCONNECTED` (no network connection is found)
|
|
222
|
-
*
|
|
223
208
|
* - `sys.NETWORK_CONNECTED_CELLULAR` (connected through mobile cellular)
|
|
224
|
-
*
|
|
225
209
|
* - `sys.NETWORK_CONNECTED` (otherwise, Wifi)
|
|
226
210
|
* @example
|
|
227
211
|
* ```ts
|
|
@@ -260,13 +244,15 @@ declare global {
|
|
|
260
244
|
* @param filename - file to read from
|
|
261
245
|
* @returns the path prefixed with the proper host mount
|
|
262
246
|
* @example
|
|
247
|
+
* Save data on the host
|
|
263
248
|
* ```ts
|
|
264
|
-
* // Save data on the host
|
|
265
249
|
* const mytable = { score: 100, level: 3 };
|
|
266
250
|
* const host_path = sys.get_host_path("logs/test.txt");
|
|
267
251
|
* sys.save(host_path, mytable);
|
|
268
|
-
*
|
|
269
|
-
*
|
|
252
|
+
* ```
|
|
253
|
+
* @example
|
|
254
|
+
* Load data from the host
|
|
255
|
+
* ```ts
|
|
270
256
|
* const host_path = sys.get_host_path("logs/test.txt");
|
|
271
257
|
* const table = sys.load(host_path);
|
|
272
258
|
* ```
|
|
@@ -402,13 +388,15 @@ declare global {
|
|
|
402
388
|
* @param path - the path to load the buffer from
|
|
403
389
|
* @returns the buffer with data
|
|
404
390
|
* @example
|
|
391
|
+
* Load binary data from a custom project resource:
|
|
405
392
|
* ```ts
|
|
406
|
-
* // Load binary data from a custom project resource:
|
|
407
393
|
* const my_buffer = sys.load_buffer("/assets/my_level_data.bin");
|
|
408
394
|
* const data_str = buffer.get_bytes(my_buffer, "data");
|
|
409
395
|
* const has_my_header = data_str.slice(0, 6) === "D3F0LD";
|
|
410
|
-
*
|
|
411
|
-
*
|
|
396
|
+
* ```
|
|
397
|
+
* @example
|
|
398
|
+
* Load binary data from non-custom resource files on disk:
|
|
399
|
+
* ```ts
|
|
412
400
|
* const asset_1 = sys.load_buffer("folder_next_to_binary/my_level_asset.txt");
|
|
413
401
|
* const asset_2 = sys.load_buffer("/my/absolute/path");
|
|
414
402
|
* ```
|
|
@@ -436,27 +424,27 @@ declare global {
|
|
|
436
424
|
* number The status of the request, supported values are:
|
|
437
425
|
*
|
|
438
426
|
* - `resource.REQUEST_STATUS_FINISHED`
|
|
439
|
-
*
|
|
440
427
|
* - `resource.REQUEST_STATUS_ERROR_IO_ERROR`
|
|
441
|
-
*
|
|
442
428
|
* - `resource.REQUEST_STATUS_ERROR_NOT_FOUND`
|
|
443
429
|
*
|
|
444
430
|
* `buffer`
|
|
445
431
|
* buffer If the request was successfull, this will contain the request payload in a buffer object, and nil otherwise. Make sure to check the status before doing anything with the buffer value!
|
|
446
432
|
* @returns a handle to the request
|
|
447
433
|
* @example
|
|
434
|
+
* Load binary data from a custom project resource and update a texture resource:
|
|
448
435
|
* ```ts
|
|
449
|
-
* // Load binary data from a custom project resource and update a texture resource:
|
|
450
436
|
* function my_callback(self: unknown, request_id: unknown, result: unknown) {
|
|
451
437
|
* const { status, buf } = result as { status: number; buf: Opaque<"buffer"> };
|
|
452
|
-
* if (status ===
|
|
453
|
-
* resource.set_texture("/my_texture", {}, buf);
|
|
438
|
+
* if (status === sys.REQUEST_STATUS_FINISHED) {
|
|
439
|
+
* resource.set_texture("/my_texture", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format: graphics.TEXTURE_FORMAT_RGBA }, buf);
|
|
454
440
|
* }
|
|
455
441
|
* }
|
|
456
442
|
*
|
|
457
443
|
* const my_request = sys.load_buffer_async("/assets/my_level_data.bin", my_callback);
|
|
458
|
-
*
|
|
459
|
-
*
|
|
444
|
+
* ```
|
|
445
|
+
* @example
|
|
446
|
+
* Load binary data from non-custom resource files on disk:
|
|
447
|
+
* ```ts
|
|
460
448
|
* function my_callback(self: unknown, request_id: unknown, result: unknown) {
|
|
461
449
|
* const { first_asset, second_asset } = self as { first_asset: Hash; second_asset: Hash };
|
|
462
450
|
* if ((result as { status: number }).status !== sys.REQUEST_STATUS_FINISHED) {
|
|
@@ -469,11 +457,15 @@ declare global {
|
|
|
469
457
|
* }
|
|
470
458
|
*
|
|
471
459
|
* export default defineScript({
|
|
472
|
-
* init(
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
460
|
+
* init() {
|
|
461
|
+
* const first_path = "folder_next_to_binary/my_level_asset.bin";
|
|
462
|
+
* const second_path = "/some_absolute_path/my_level.bin";
|
|
463
|
+
* return {
|
|
464
|
+
* first_asset: hash(first_path),
|
|
465
|
+
* second_asset: hash(second_path),
|
|
466
|
+
* first_request: sys.load_buffer_async(first_path, my_callback),
|
|
467
|
+
* second_request: sys.load_buffer_async(second_path, my_callback),
|
|
468
|
+
* };
|
|
477
469
|
* },
|
|
478
470
|
* });
|
|
479
471
|
* ```
|
|
@@ -572,7 +564,7 @@ declare global {
|
|
|
572
564
|
* sys.save(my_file_path, my_table);
|
|
573
565
|
* ```
|
|
574
566
|
*/
|
|
575
|
-
function save(filename: string, table: Record<string | number, unknown>):
|
|
567
|
+
function save(filename: string, table: Record<string | number, unknown> | readonly unknown[]): boolean;
|
|
576
568
|
/**
|
|
577
569
|
* The buffer can later deserialized by `sys.deserialize`.
|
|
578
570
|
* This function has all the same limitations as `sys.save`.
|
|
@@ -588,7 +580,7 @@ declare global {
|
|
|
588
580
|
* const buffer = sys.serialize(my_table);
|
|
589
581
|
* ```
|
|
590
582
|
*/
|
|
591
|
-
function serialize(table: Record<string | number, unknown>): string;
|
|
583
|
+
function serialize(table: Record<string | number, unknown> | readonly unknown[]): string;
|
|
592
584
|
/**
|
|
593
585
|
* Sets the host that is used to check for network connectivity against.
|
|
594
586
|
*
|
|
@@ -599,21 +591,6 @@ declare global {
|
|
|
599
591
|
* ```
|
|
600
592
|
*/
|
|
601
593
|
function set_connectivity_host(host: string): void;
|
|
602
|
-
/**
|
|
603
|
-
* Enables engine throttling.
|
|
604
|
-
*
|
|
605
|
-
* @param enable - true if throttling should be enabled
|
|
606
|
-
* @param cooldown - the time period to do update + render for (seconds)
|
|
607
|
-
* @example
|
|
608
|
-
* ```ts
|
|
609
|
-
* // Disable throttling
|
|
610
|
-
* sys.set_engine_throttle(false);
|
|
611
|
-
*
|
|
612
|
-
* // Enable throttling
|
|
613
|
-
* sys.set_engine_throttle(true, 1.5);
|
|
614
|
-
* ```
|
|
615
|
-
*/
|
|
616
|
-
function set_engine_throttle(enable: boolean, cooldown?: number): void;
|
|
617
594
|
/**
|
|
618
595
|
* Set the Lua error handler function.
|
|
619
596
|
* The error handler is a function which is called whenever a lua runtime error occurs.
|
|
@@ -657,10 +634,10 @@ declare global {
|
|
|
657
634
|
* @example
|
|
658
635
|
* ```ts
|
|
659
636
|
* // Disable rendering
|
|
660
|
-
* sys.
|
|
637
|
+
* sys.set_render_enabled(false);
|
|
661
638
|
* ```
|
|
662
639
|
*/
|
|
663
|
-
function
|
|
640
|
+
function set_render_enabled(enable: boolean): void;
|
|
664
641
|
/**
|
|
665
642
|
* Set game update-frequency (frame cap). This option is equivalent to `display.update_frequency` in
|
|
666
643
|
* the "game.project" settings but set in run-time. If `Vsync` checked in "game.project", the rate will
|