@defold-typescript/types 0.40.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.
Files changed (224) hide show
  1. package/api-availability.json +3963 -772
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18069 -10240
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +560 -89
  6. package/fixtures/messages_doc.json +96 -0
  7. package/generated/b2d.d.ts +680 -4
  8. package/generated/b2d_body.d.ts +29 -103
  9. package/generated/b2d_chain.d.ts +5 -6
  10. package/generated/b2d_fixture.d.ts +34 -38
  11. package/generated/b2d_joint.d.ts +503 -25
  12. package/generated/b2d_shape.d.ts +183 -20
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +16 -15
  15. package/generated/builtin-messages.d.ts +7 -1
  16. package/generated/bullet3d.d.ts +91 -0
  17. package/generated/bullet3d_collision_object.d.ts +433 -0
  18. package/generated/bullet3d_constraint.d.ts +818 -0
  19. package/generated/bullet3d_rigid_body.d.ts +429 -0
  20. package/generated/bullet3d_shape.d.ts +123 -0
  21. package/generated/bullet3d_world.d.ts +492 -0
  22. package/generated/camera.d.ts +29 -32
  23. package/generated/collectionfactory.d.ts +15 -18
  24. package/generated/collectionproxy.d.ts +22 -6
  25. package/generated/compute.d.ts +12 -238
  26. package/generated/crash.d.ts +24 -10
  27. package/generated/editor-vm/http.d.ts +90 -7
  28. package/generated/editor-vm/image.d.ts +7 -7
  29. package/generated/editor-vm/json.d.ts +11 -0
  30. package/generated/editor-vm/localization.d.ts +7 -7
  31. package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
  32. package/generated/editor-vm/zip.d.ts +28 -0
  33. package/generated/editor.d.ts +1496 -430
  34. package/generated/factory.d.ts +21 -25
  35. package/generated/font.d.ts +64 -22
  36. package/generated/go.d.ts +235 -182
  37. package/generated/graphics.d.ts +335 -97
  38. package/generated/gui.d.ts +240 -471
  39. package/generated/html5.d.ts +2 -2
  40. package/generated/http.d.ts +28 -35
  41. package/generated/image.d.ts +105 -72
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +7 -0
  44. package/generated/kinds/render-script.d.ts +7 -0
  45. package/generated/kinds/script.d.ts +7 -0
  46. package/generated/label.d.ts +77 -7
  47. package/generated/liveupdate.d.ts +13 -10
  48. package/generated/material.d.ts +312 -360
  49. package/generated/model.d.ts +40 -39
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +365 -133
  52. package/generated/profiler.d.ts +13 -23
  53. package/generated/render.d.ts +237 -297
  54. package/generated/resource.d.ts +664 -583
  55. package/generated/socket.d.ts +120 -133
  56. package/generated/sound.d.ts +62 -31
  57. package/generated/sprite.d.ts +31 -17
  58. package/generated/sys.d.ts +234 -190
  59. package/generated/tilemap.d.ts +21 -16
  60. package/generated/timer.d.ts +34 -21
  61. package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
  62. package/generated/versions/defold-1.12.4/buffer.d.ts +1 -3
  63. package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
  65. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
  66. package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
  67. package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
  68. package/generated/versions/defold-1.12.4/go.d.ts +6 -12
  69. package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
  70. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  71. package/generated/versions/defold-1.12.4/http.d.ts +0 -13
  72. package/generated/versions/defold-1.12.4/image.d.ts +16 -33
  73. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  74. package/generated/versions/defold-1.12.4/json.d.ts +10 -6
  75. package/generated/versions/defold-1.12.4/label.d.ts +2 -3
  76. package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
  77. package/generated/versions/defold-1.12.4/model.d.ts +2 -10
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
  81. package/generated/versions/defold-1.12.4/render.d.ts +99 -128
  82. package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
  83. package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
  84. package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
  86. package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
  87. package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
  88. package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
  89. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -21
  90. package/generated/versions/defold-1.12.4/window.d.ts +1 -16
  91. package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
  92. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
  93. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +169 -8
  94. package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
  95. package/generated/versions/defold-1.13.0/buffer.d.ts +1 -3
  96. package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
  100. package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
  101. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
  102. package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
  103. package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
  104. package/generated/versions/defold-1.13.0/go.d.ts +6 -12
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
  107. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  108. package/generated/versions/defold-1.13.0/http.d.ts +0 -13
  109. package/generated/versions/defold-1.13.0/image.d.ts +16 -33
  110. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  111. package/generated/versions/defold-1.13.0/json.d.ts +10 -6
  112. package/generated/versions/defold-1.13.0/label.d.ts +2 -3
  113. package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
  114. package/generated/versions/defold-1.13.0/material.d.ts +68 -106
  115. package/generated/versions/defold-1.13.0/model.d.ts +2 -10
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
  119. package/generated/versions/defold-1.13.0/render.d.ts +99 -128
  120. package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
  121. package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
  122. package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
  124. package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
  125. package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
  126. package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
  127. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -21
  128. package/generated/versions/defold-1.13.0/window.d.ts +1 -16
  129. package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
  130. package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
  131. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
  132. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
  133. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
  134. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
  135. package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
  136. package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
  137. package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
  138. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
  139. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
  140. package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
  141. package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
  142. package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
  143. package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
  144. package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
  145. package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
  146. package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
  147. package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
  148. package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
  149. package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
  150. package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
  151. package/generated/versions/defold-1.13.1/font.d.ts +81 -0
  152. package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
  153. package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
  154. package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
  155. package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
  156. package/generated/versions/defold-1.13.1/http.d.ts +77 -0
  157. package/generated/versions/defold-1.13.1/image.d.ts +131 -0
  158. package/generated/versions/defold-1.13.1/index.d.ts +57 -0
  159. package/generated/versions/defold-1.13.1/json.d.ts +80 -0
  160. package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
  161. package/generated/versions/defold-1.13.1/label.d.ts +93 -0
  162. package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
  163. package/generated/versions/defold-1.13.1/material.d.ts +408 -0
  164. package/generated/versions/defold-1.13.1/model.d.ts +272 -0
  165. package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
  166. package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
  167. package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
  168. package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
  169. package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
  170. package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
  171. package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
  172. package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
  173. package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
  174. package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
  175. package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
  176. package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
  177. package/generated/versions/defold-1.13.1/types.d.ts +61 -0
  178. package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
  179. package/generated/versions/defold-1.13.1/window.d.ts +183 -0
  180. package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
  181. package/generated/vmath.d.ts +1 -21
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +7 -0
  185. package/package.json +13 -2
  186. package/scripts/example-store-io.ts +12 -1
  187. package/scripts/extension-goldens.ts +1 -0
  188. package/scripts/fidelity-baseline.json +146 -46
  189. package/scripts/generate-api-availability.ts +90 -12
  190. package/scripts/generate-api-signatures.ts +12 -2
  191. package/scripts/import-defold-release.ts +85 -24
  192. package/scripts/prose-constants.ts +77 -16
  193. package/scripts/regen.ts +391 -77
  194. package/scripts/shared-handle-methods.ts +53 -0
  195. package/scripts/signature-store-fs.ts +1 -0
  196. package/scripts/sync-api-docs.ts +16 -5
  197. package/src/api-availability.ts +0 -0
  198. package/src/api-doc.ts +201 -3
  199. package/src/api-identity.ts +252 -0
  200. package/src/core-types.ts +26 -3
  201. package/src/correction-pins.ts +49 -0
  202. package/src/doc-comment.ts +104 -11
  203. package/src/doc-corrections.ts +108 -0
  204. package/src/editor-vm-globals.d.ts +5 -2
  205. package/src/emit-dts.ts +2064 -281
  206. package/src/emit-messages.ts +52 -0
  207. package/src/example-store.ts +125 -14
  208. package/src/field-correction-coverage.ts +204 -0
  209. package/src/fnv1a.ts +16 -0
  210. package/src/go-overloads.d.ts +25 -6
  211. package/src/index-base-table.ts +145 -0
  212. package/src/index-slot-classifications.ts +588 -0
  213. package/src/index.ts +38 -5
  214. package/src/library-index-slot-classifications.ts +332 -0
  215. package/src/lifecycle.ts +61 -199
  216. package/src/luals-type-expr.ts +354 -0
  217. package/src/msg-overloads.d.ts +0 -1
  218. package/src/param-correction-provenance.ts +8 -11
  219. package/src/render-overloads.d.ts +0 -15
  220. package/src/return-correction-provenance.ts +58 -16
  221. package/src/sys-overloads.d.ts +48 -0
  222. package/src/vmath-overloads.d.ts +27 -1
  223. package/src/window-event-guard.d.ts +6 -9
  224. package/url-parameters.json +1 -2
@@ -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
  */
@@ -702,20 +676,18 @@ declare global {
702
676
  * @param ret2 - argument 2.
703
677
  * @param retN - argument N.
704
678
  * @example
679
+ * Instead of doing the following with dummy variables:
705
680
  * ```ts
706
681
  * const line = "250 OK";
707
- *
708
- * // Instead of doing the following with dummy variables:
709
- * {
710
- * // get the status code and separator from SMTP server reply
711
- * const [dummy1, dummy2, code, sep] = string.find(line, "^(%d%d%d)(.?)");
712
- * }
713
- *
714
- * // You can skip a number of variables:
715
- * {
716
- * // get the status code and separator from SMTP server reply
717
- * const [code, sep] = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"));
718
- * }
682
+ * // get the status code and separator from SMTP server reply
683
+ * const [dummy1, dummy2, code, sep] = string.find(line, "^(%d%d%d)(.?)");
684
+ * ```
685
+ * @example
686
+ * You can skip a number of variables:
687
+ * ```ts
688
+ * const line = "250 OK";
689
+ * // get the status code and separator from SMTP server reply
690
+ * const [code, sep] = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"));
719
691
  * ```
720
692
  */
721
693
  function skip(d: number, ret1?: unknown, ret2?: unknown, retN?: unknown): LuaMultiReturn<[unknown, unknown, unknown]>;
@@ -749,18 +721,19 @@ declare global {
749
721
  * The supplied address can be an IPv4 or IPv6 address or host name.
750
722
  * The function returns a table with all information returned by the resolver:
751
723
  *
752
- * `{
753
- * [1] = {
754
- * family = family-name-1,
755
- * addr = address-1
756
- * },
757
- * ...
758
- * [n] = {
759
- * family = family-name-n,
760
- * addr = address-n
761
- * }
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
+ * }
762
735
  * }
763
- * `
736
+ * ```
764
737
  *
765
738
  * Here, family contains the string `"inet"` for IPv4 addresses, and `"inet6"` for IPv6 addresses.
766
739
  * In case of error, the function returns nil followed by an error message.
@@ -779,12 +752,13 @@ declare global {
779
752
  * The supplied address can be an IPv4 or IPv6 address or host name.
780
753
  * The function returns a table with all information returned by the resolver:
781
754
  *
782
- * `{
783
- * [1] = host-name-1,
784
- * ...
785
- * [n] = host-name-n,
755
+ * ```lua
756
+ * {
757
+ * [1] = host-name-1,
758
+ * ...
759
+ * [n] = host-name-n,
786
760
  * }
787
- * `
761
+ * ```
788
762
  *
789
763
  * @param address - a hostname or an IPv4 or IPv6 address.
790
764
  */
@@ -38,7 +38,7 @@ declare global {
38
38
  * }
39
39
  * ```
40
40
  */
41
- function get_group_name(group: string | Hash): string;
41
+ function get_group_name(group: Hash): string;
42
42
  /**
43
43
  * Get a table of all mixer group names (hashes).
44
44
  *
@@ -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
- * // Using the callback argument, you can chain several sounds together:
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 };
@@ -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?: number): void;
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?: number): void;
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");
@@ -106,7 +116,7 @@ declare global {
106
116
  /**
107
117
  * READ ONLY The current animation id. An animation that plays currently for the sprite. The type of the property is hash.
108
118
  */
109
- animation: Hash;
119
+ readonly animation: Hash;
110
120
  /**
111
121
  * The normalized animation cursor. The type of the property is number.
112
122
  */
@@ -114,7 +124,7 @@ declare global {
114
124
  /**
115
125
  * READ ONLY The frame count of the currently playing animation.
116
126
  */
117
- frame_count: number;
127
+ readonly frame_count: number;
118
128
  /**
119
129
  * The image used when rendering the sprite. The type of the property is hash.
120
130
  */
@@ -95,8 +95,8 @@ declare global {
95
95
  * `installed`
96
96
  * boolean `true` if the application is installed, `false` otherwise.
97
97
  * @example
98
+ * Check if twitter is installed:
98
99
  * ```ts
99
- * // Check if twitter is installed:
100
100
  * const sysinfo = sys.get_sys_info();
101
101
  * let twitter: { installed?: boolean } = {};
102
102
  *
@@ -109,8 +109,10 @@ declare global {
109
109
  * if (twitter.installed) {
110
110
  * // twitter is installed!
111
111
  * }
112
- *
113
- * // Info.plist for the iOS app needs to list the schemes that are queried:
112
+ * ```
113
+ * @example
114
+ * Info.plist for the iOS app needs to list the schemes that are queried:
115
+ * ```ts
114
116
  * // ...
115
117
  * // <key>LSApplicationQueriesSchemes</key>
116
118
  * // <array>
@@ -169,10 +171,12 @@ declare global {
169
171
  * @param default_value - (optional) default value to return if the value does not exist
170
172
  * @returns config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
171
173
  * @example
174
+ * Get user config value
172
175
  * ```ts
173
- * // Get user config value
174
176
  * const speed = sys.get_config_int("my_game.speed", 20); // with default value
175
- *
177
+ * ```
178
+ * @example
179
+ * ```ts
176
180
  * const testmode = sys.get_config_int("my_game.testmode"); // without default value
177
181
  * if (testmode !== undefined) {
178
182
  * // do stuff
@@ -193,25 +197,6 @@ declare global {
193
197
  * ```
194
198
  */
195
199
  function get_config_number(key: string, default_value?: number): number;
196
- /**
197
- * Get string config value from the game.project configuration file with optional default value
198
- *
199
- * @param key - key to get value for. The syntax is SECTION.KEY
200
- * @param default_value - (optional) default value to return if the value does not exist
201
- * @returns config value as a string. default_value if the config key does not exist. nil if no default value was supplied.
202
- * @example
203
- * ```ts
204
- * // Get user config value
205
- * const text = sys.get_config_string("my_game.text", "default text");
206
- *
207
- * // Start the engine with a bootstrap config override and add a custom config value
208
- * // $ dmengine --config=bootstrap.main_collection=/mytest.collectionc --config=mygame.testmode=1
209
- *
210
- * // Read the custom config value from the command line
211
- * const testmode = sys.get_config_int("mygame.testmode");
212
- * ```
213
- */
214
- function get_config_string(key: string, default_value?: string): string;
215
200
  /**
216
201
  * Returns the current network connectivity status
217
202
  * on mobile platforms.
@@ -220,9 +205,7 @@ declare global {
220
205
  * @returns network connectivity status:
221
206
  *
222
207
  * - `sys.NETWORK_DISCONNECTED` (no network connection is found)
223
- *
224
208
  * - `sys.NETWORK_CONNECTED_CELLULAR` (connected through mobile cellular)
225
- *
226
209
  * - `sys.NETWORK_CONNECTED` (otherwise, Wifi)
227
210
  * @example
228
211
  * ```ts
@@ -261,19 +244,17 @@ declare global {
261
244
  * @param filename - file to read from
262
245
  * @returns the path prefixed with the proper host mount
263
246
  * @example
247
+ * Save data on the host
264
248
  * ```ts
265
- * // Save data on the host
266
- * {
267
- * const mytable = { score: 100, level: 3 };
268
- * const host_path = sys.get_host_path("logs/test.txt");
269
- * sys.save(host_path, mytable);
270
- * }
271
- *
272
- * // Load data from the host
273
- * {
274
- * const host_path = sys.get_host_path("logs/test.txt");
275
- * const table = sys.load(host_path);
276
- * }
249
+ * const mytable = { score: 100, level: 3 };
250
+ * const host_path = sys.get_host_path("logs/test.txt");
251
+ * sys.save(host_path, mytable);
252
+ * ```
253
+ * @example
254
+ * Load data from the host
255
+ * ```ts
256
+ * const host_path = sys.get_host_path("logs/test.txt");
257
+ * const table = sys.load(host_path);
277
258
  * ```
278
259
  */
279
260
  function get_host_path(filename: string): string;
@@ -407,13 +388,15 @@ declare global {
407
388
  * @param path - the path to load the buffer from
408
389
  * @returns the buffer with data
409
390
  * @example
391
+ * Load binary data from a custom project resource:
410
392
  * ```ts
411
- * // Load binary data from a custom project resource:
412
393
  * const my_buffer = sys.load_buffer("/assets/my_level_data.bin");
413
394
  * const data_str = buffer.get_bytes(my_buffer, "data");
414
395
  * const has_my_header = data_str.slice(0, 6) === "D3F0LD";
415
- *
416
- * // Load binary data from non-custom resource files on disk:
396
+ * ```
397
+ * @example
398
+ * Load binary data from non-custom resource files on disk:
399
+ * ```ts
417
400
  * const asset_1 = sys.load_buffer("folder_next_to_binary/my_level_asset.txt");
418
401
  * const asset_2 = sys.load_buffer("/my/absolute/path");
419
402
  * ```
@@ -441,29 +424,27 @@ declare global {
441
424
  * number The status of the request, supported values are:
442
425
  *
443
426
  * - `resource.REQUEST_STATUS_FINISHED`
444
- *
445
427
  * - `resource.REQUEST_STATUS_ERROR_IO_ERROR`
446
- *
447
428
  * - `resource.REQUEST_STATUS_ERROR_NOT_FOUND`
448
429
  *
449
430
  * `buffer`
450
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!
451
432
  * @returns a handle to the request
452
433
  * @example
434
+ * Load binary data from a custom project resource and update a texture resource:
453
435
  * ```ts
454
- * // Load binary data from a custom project resource and update a texture resource:
455
- * {
456
- * function my_callback(self: unknown, request_id: unknown, result: unknown) {
457
- * const { status, buf } = result as { status: number; buf: Opaque<"buffer"> };
458
- * if (status === sys.REQUEST_STATUS_FINISHED) {
459
- * resource.set_texture("/my_texture", {}, buf); // texture args
460
- * }
436
+ * function my_callback(self: unknown, request_id: unknown, result: unknown) {
437
+ * const { status, buf } = result as { status: number; buf: Opaque<"buffer"> };
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);
461
440
  * }
462
- *
463
- * const my_request = sys.load_buffer_async("/assets/my_level_data.bin", my_callback);
464
441
  * }
465
442
  *
466
- * // Load binary data from non-custom resource files on disk:
443
+ * const my_request = sys.load_buffer_async("/assets/my_level_data.bin", my_callback);
444
+ * ```
445
+ * @example
446
+ * Load binary data from non-custom resource files on disk:
447
+ * ```ts
467
448
  * function my_callback(self: unknown, request_id: unknown, result: unknown) {
468
449
  * const { first_asset, second_asset } = self as { first_asset: Hash; second_asset: Hash };
469
450
  * if ((result as { status: number }).status !== sys.REQUEST_STATUS_FINISHED) {
@@ -583,7 +564,7 @@ declare global {
583
564
  * sys.save(my_file_path, my_table);
584
565
  * ```
585
566
  */
586
- function save(filename: string, table: Record<string | number, unknown> | readonly unknown[]): void;
567
+ function save(filename: string, table: Record<string | number, unknown> | readonly unknown[]): boolean;
587
568
  /**
588
569
  * The buffer can later deserialized by `sys.deserialize`.
589
570
  * This function has all the same limitations as `sys.save`.
@@ -610,21 +591,6 @@ declare global {
610
591
  * ```
611
592
  */
612
593
  function set_connectivity_host(host: string): void;
613
- /**
614
- * Enables engine throttling.
615
- *
616
- * @param enable - true if throttling should be enabled
617
- * @param cooldown - the time period to do update + render for (seconds)
618
- * @example
619
- * ```ts
620
- * // Disable throttling
621
- * sys.set_engine_throttle(false);
622
- *
623
- * // Enable throttling
624
- * sys.set_engine_throttle(true, 1.5);
625
- * ```
626
- */
627
- function set_engine_throttle(enable: boolean, cooldown?: number): void;
628
594
  /**
629
595
  * Set the Lua error handler function.
630
596
  * The error handler is a function which is called whenever a lua runtime error occurs.
@@ -668,10 +634,10 @@ declare global {
668
634
  * @example
669
635
  * ```ts
670
636
  * // Disable rendering
671
- * sys.set_render_enable(false);
637
+ * sys.set_render_enabled(false);
672
638
  * ```
673
639
  */
674
- function set_render_enable(enable: boolean): void;
640
+ function set_render_enabled(enable: boolean): void;
675
641
  /**
676
642
  * Set game update-frequency (frame cap). This option is equivalent to `display.update_frequency` in
677
643
  * the "game.project" settings but set in run-time. If `Vsync` checked in "game.project", the rate will
@@ -34,6 +34,11 @@ declare global {
34
34
  * the bounds are calculated as if all layers were collapsed into one.
35
35
  *
36
36
  * @param url - the tile map
37
+ * @returns `[x, y, w, h]`:
38
+ * - `x` — x coordinate of the bottom left corner. **⚠️ 1-based; passed to Defold unchanged.**
39
+ * - `y` — y coordinate of the bottom left corner. **⚠️ 1-based; passed to Defold unchanged.**
40
+ * - `w` — number of columns (width) in the tile map
41
+ * - `h` — number of rows (height) in the tile map
37
42
  * @example
38
43
  * ```ts
39
44
  * // get the level bounds.
@@ -50,8 +55,8 @@ declare global {
50
55
  *
51
56
  * @param url - the tile map
52
57
  * @param layer - name of the layer for the tile
53
- * @param x - x-coordinate of the tile
54
- * @param y - y-coordinate of the tile
58
+ * @param x - x-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
59
+ * @param y - y-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
55
60
  * @returns index of the tile
56
61
  * @example
57
62
  * ```ts
@@ -71,8 +76,8 @@ declare global {
71
76
  *
72
77
  * @param url - the tile map
73
78
  * @param layer - name of the layer for the tile
74
- * @param x - x-coordinate of the tile
75
- * @param y - y-coordinate of the tile
79
+ * @param x - x-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
80
+ * @param y - y-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
76
81
  * @returns index of the tile
77
82
  * @example
78
83
  * ```ts
@@ -120,15 +125,17 @@ declare global {
120
125
  * above and to the right of origin has coordinates 1,1.
121
126
  * Tiles to the left of and below origin are indexed 0, -1, -2 and so forth.
122
127
  *
128
+ * ```text
123
129
  * +-------+-------+------+------+
124
- * | 0,3 | 1,3 | 2,3 | 3,3 |
130
+ * | 0,3 | 1,3 | 2,3 | 3,3 |
125
131
  * +-------+-------+------+------+
126
- * | 0,2 | 1,2 | 2,2 | 3,2 |
132
+ * | 0,2 | 1,2 | 2,2 | 3,2 |
127
133
  * +-------+-------+------+------+
128
- * | 0,1 | 1,1 | 2,1 | 3,1 |
134
+ * | 0,1 | 1,1 | 2,1 | 3,1 |
129
135
  * +-------O-------+------+------+
130
- * | 0,0 | 1,0 | 2,0 | 3,0 |
136
+ * | 0,0 | 1,0 | 2,0 | 3,0 |
131
137
  * +-------+-------+------+------+
138
+ * ```
132
139
  *
133
140
  * The coordinates must be within the bounds of the tile map as it were created.
134
141
  * That is, it is not possible to extend the size of a tile map by setting tiles outside the edges.
@@ -139,8 +146,8 @@ declare global {
139
146
  *
140
147
  * @param url - the tile map
141
148
  * @param layer - name of the layer for the tile
142
- * @param x - x-coordinate of the tile
143
- * @param y - y-coordinate of the tile
149
+ * @param x - x-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
150
+ * @param y - y-coordinate of the tile. **⚠️ 1-based; passed to Defold unchanged.**
144
151
  * @param tile - index of new tile to set. 0 resets the cell
145
152
  * @param transform_bitmask - optional flip and/or rotation should be applied to the tile
146
153
  * @example
@@ -157,7 +164,7 @@ declare global {
157
164
  * }
158
165
  * ```
159
166
  */
160
- function set_tile(url: string | Hash | Url, layer: string | Hash, x: number, y: number, tile: number, transform_bitmask?: number): void;
167
+ function set_tile(url: string | Hash | Url, layer: string | Hash, x: number, y: number, tile: number, transform_bitmask?: number): boolean;
161
168
  /**
162
169
  * Sets the visibility of the tilemap layer
163
170
  *
@@ -51,11 +51,13 @@ declare global {
51
51
  * number The elapsed time - on first trigger it is time since timer.delay call, otherwise time since last trigger
52
52
  * @returns identifier for the create timer, returns timer.INVALID_TIMER_HANDLE if the timer can not be created
53
53
  * @example
54
+ * A simple one-shot timer
54
55
  * ```ts
55
- * // A simple one-shot timer
56
56
  * timer.delay(1, false, () => print("print in one second"));
57
- *
58
- * // Repetitive timer which canceled after 10 calls
57
+ * ```
58
+ * @example
59
+ * Repetitive timer which canceled after 10 calls
60
+ * ```ts
59
61
  * function call_every_second(self: unknown, handle: unknown, time_elapsed: unknown) {
60
62
  * const state = self as { counter: number };
61
63
  * state.counter = state.counter + 1;
@@ -74,9 +74,7 @@ declare global {
74
74
  * where θ is the angle between the vectors P and Q.
75
75
  *
76
76
  * - If the dot product is positive then the angle between the vectors is below 90 degrees.
77
- *
78
77
  * - If the dot product is zero the vectors are perpendicular (at right-angles to each other).
79
- *
80
78
  * - If the dot product is negative then the angle between the vectors is more than 90 degrees.
81
79
  *
82
80
  * @param v1 - first vector
@@ -643,25 +641,6 @@ declare global {
643
641
  * ```
644
642
  */
645
643
  function rotate(q: Quaternion, v1: Vector3): Vector3;
646
- /**
647
- * Creates a vector of arbitrary size. The vector is initialized
648
- * with numeric values from a table.
649
- * The table values are converted to floating point
650
- * values. If a value cannot be converted, a 0 is stored in that
651
- * value position in the vector.
652
- *
653
- * @param t - table of numbers
654
- * @returns new vector
655
- * @example
656
- * ```ts
657
- * // How to create a vector with custom data to be used for animation easing:
658
- * const values = [0, 0.5, 0];
659
- * const vec = vmath.vector(values);
660
- * print(vec); // => vmath.vector (size: 3)
661
- * print(vec[2]); // => 0.5
662
- * ```
663
- */
664
- function vector(t: number[]): Vector;
665
644
  /**
666
645
  * Creates a new zero vector with all components set to 0.
667
646
  *