@defold-typescript/types 0.44.1 → 0.45.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 (42) hide show
  1. package/examples/translations.json +34 -34
  2. package/generated/b2d_fixture.d.ts +23 -1
  3. package/generated/b2d_shape.d.ts +22 -1
  4. package/generated/compute.d.ts +29 -2
  5. package/generated/go.d.ts +2 -2
  6. package/generated/gui.d.ts +5 -7
  7. package/generated/material.d.ts +98 -8
  8. package/generated/model.d.ts +11 -5
  9. package/generated/particlefx.d.ts +5 -7
  10. package/generated/render.d.ts +12 -18
  11. package/generated/sys.d.ts +8 -10
  12. package/generated/versions/defold-1.12.4/go.d.ts +2 -2
  13. package/generated/versions/defold-1.12.4/gui.d.ts +5 -7
  14. package/generated/versions/defold-1.12.4/particlefx.d.ts +5 -7
  15. package/generated/versions/defold-1.12.4/render.d.ts +12 -18
  16. package/generated/versions/defold-1.12.4/sys.d.ts +8 -10
  17. package/generated/versions/defold-1.12.4/window.d.ts +13 -15
  18. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +23 -1
  19. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +22 -1
  20. package/generated/versions/defold-1.13.0/compute.d.ts +29 -2
  21. package/generated/versions/defold-1.13.0/go.d.ts +2 -2
  22. package/generated/versions/defold-1.13.0/gui.d.ts +5 -7
  23. package/generated/versions/defold-1.13.0/material.d.ts +98 -8
  24. package/generated/versions/defold-1.13.0/model.d.ts +11 -5
  25. package/generated/versions/defold-1.13.0/particlefx.d.ts +5 -7
  26. package/generated/versions/defold-1.13.0/render.d.ts +12 -18
  27. package/generated/versions/defold-1.13.0/sys.d.ts +8 -10
  28. package/generated/versions/defold-1.13.0/window.d.ts +13 -15
  29. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +23 -1
  30. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +22 -1
  31. package/generated/versions/defold-1.13.1/compute.d.ts +29 -2
  32. package/generated/versions/defold-1.13.1/go.d.ts +2 -2
  33. package/generated/versions/defold-1.13.1/gui.d.ts +5 -7
  34. package/generated/versions/defold-1.13.1/material.d.ts +98 -8
  35. package/generated/versions/defold-1.13.1/model.d.ts +11 -5
  36. package/generated/versions/defold-1.13.1/particlefx.d.ts +5 -7
  37. package/generated/versions/defold-1.13.1/render.d.ts +12 -18
  38. package/generated/versions/defold-1.13.1/sys.d.ts +8 -10
  39. package/generated/versions/defold-1.13.1/window.d.ts +13 -15
  40. package/generated/window.d.ts +13 -15
  41. package/hsm/index.d.ts +69 -90
  42. package/package.json +3 -1
@@ -62,10 +62,14 @@ declare global {
62
62
  * @returns array of weight values, or empty table if the model has no morph targets
63
63
  * @example
64
64
  * ```ts
65
- * const weights = model.get_blend_weights("#model");
66
- * weights[1] = 0.75;
67
- * weights[2] = 0.25;
68
- * model.set_blend_weights("#model", weights);
65
+ * const w = model.get_blend_weights("#model");
66
+ * w.forEach((weight, i) => {
67
+ * print(i + 1, weight);
68
+ * });
69
+ * // change the data in the table and then set the weights again
70
+ * w[0] = 0.75;
71
+ * w[1] = 0.25;
72
+ * model.set_blend_weights("#model", w);
69
73
  * ```
70
74
  */
71
75
  function get_blend_weights(url: string | Hash | Url): number[];
@@ -206,8 +210,10 @@ declare global {
206
210
  * @param weights - array of weight values (1-based indices). Omit or pass `nil` to clear the override and return morphs to animation only
207
211
  * @example
208
212
  * ```ts
213
+ * // set the weights for the first 4 morph targets
209
214
  * model.set_blend_weights("#model", [0, 1, 0.5, 0]);
210
- * model.set_blend_weights("#model");
215
+ * // clear the override, animation will continue if the weights are driven by an animation
216
+ * model.set_blend_weights("#model"); // clear script override
211
217
  * ```
212
218
  */
213
219
  function set_blend_weights(url: string | Hash | Url, weights?: number[]): void;
@@ -46,15 +46,13 @@ declare global {
46
46
  * // How to play a particle fx when a game object is created.
47
47
  * // The callback receives the hash of the path to the particlefx, the hash of the id
48
48
  * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
49
- * function emitter_state_change(self: unknown, id: unknown, emitter: unknown, state: unknown) {
50
- * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
51
- * // exhaust is done spawning particles...
52
- * }
53
- * }
54
- *
55
49
  * export default defineScript({
56
50
  * init(self) {
57
- * particlefx.play("#particlefx", emitter_state_change);
51
+ * particlefx.play("#particlefx", (self, id, emitter, state) => {
52
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
53
+ * // exhaust is done spawning particles...
54
+ * }
55
+ * });
58
56
  * },
59
57
  * });
60
58
  * ```
@@ -184,11 +184,16 @@ declare global {
184
184
  * @example
185
185
  * Then use the constant buffer when drawing a predicate:
186
186
  * ```ts
187
- * function draw_tinted(self: { my_pred: Opaque<"render_predicate"> }) {
188
- * const constants = render.constant_buffer();
189
- * constants.tint = vmath.vector4(1, 1, 1, 1);
190
- * render.draw(self.my_pred, { constants });
191
- * }
187
+ * export default defineRenderScript({
188
+ * init() {
189
+ * return { my_pred: render.predicate([hash("my_tag")]) };
190
+ * },
191
+ *
192
+ * update(self, dt) {
193
+ * const constants = render.constant_buffer();
194
+ * render.draw(self.my_pred, { constants });
195
+ * },
196
+ * });
192
197
  * ```
193
198
  * @example
194
199
  * The constant buffer also supports array values by specifying constants in a table:
@@ -524,13 +529,13 @@ declare global {
524
529
  * ```
525
530
  * @example
526
531
  * ```ts
527
- * // Or enable a render target by resource id:
528
532
  * export default defineRenderScript({
529
533
  * init() {
530
534
  * return { my_pred: render.predicate([hash("my_tag")]) };
531
535
  * },
532
536
  *
533
537
  * update(self, dt) {
538
+ * // enable render target by resource id
534
539
  * render.set_render_target("my_rt_resource");
535
540
  * render.draw(self.my_pred);
536
541
  * render.set_render_target(render.RENDER_TARGET_DEFAULT);
@@ -544,7 +549,6 @@ declare global {
544
549
  * ```
545
550
  * @example
546
551
  * ```ts
547
- * // Or bind a texture handle directly:
548
552
  * export default defineRenderScript({
549
553
  * init() {
550
554
  * return { my_texture_handle: resource.get_texture_info("/main/my_texture.texturec").handle };
@@ -587,15 +591,10 @@ declare global {
587
591
  * ```ts
588
592
  * export default defineRenderScript({
589
593
  * init() {
590
- * // render target buffer parameters
591
594
  * const color_params = {
592
595
  * format: graphics.TEXTURE_FORMAT_RGBA,
593
596
  * width: render.get_window_width(),
594
597
  * height: render.get_window_height(),
595
- * min_filter: graphics.TEXTURE_FILTER_LINEAR,
596
- * mag_filter: graphics.TEXTURE_FILTER_LINEAR,
597
- * u_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
598
- * v_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
599
598
  * };
600
599
  * return {
601
600
  * target_right: render.render_target("right", {
@@ -629,15 +628,10 @@ declare global {
629
628
  * ```ts
630
629
  * export default defineRenderScript({
631
630
  * init() {
632
- * // render target buffer parameters
633
631
  * const color_params = {
634
632
  * format: graphics.TEXTURE_FORMAT_RGBA,
635
633
  * width: render.get_window_width(),
636
634
  * height: render.get_window_height(),
637
- * min_filter: graphics.TEXTURE_FILTER_LINEAR,
638
- * mag_filter: graphics.TEXTURE_FILTER_LINEAR,
639
- * u_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
640
- * v_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
641
635
  * };
642
636
  * return {
643
637
  * target_right: render.render_target("right", {
@@ -993,13 +987,13 @@ declare global {
993
987
  * ```
994
988
  * @example
995
989
  * ```ts
996
- * // Or set the render target by a render target resource identifier:
997
990
  * export default defineRenderScript({
998
991
  * init() {
999
992
  * return { my_pred: render.predicate([hash("my_tag")]) };
1000
993
  * },
1001
994
  *
1002
995
  * update(self, dt) {
996
+ * // set render target by a render target resource identifier
1003
997
  * render.set_render_target("my_rt_resource");
1004
998
  *
1005
999
  * // draw a predicate to the render target
@@ -670,22 +670,20 @@ declare global {
670
670
  * string The stack traceback.
671
671
  * @example
672
672
  * ```ts
673
- * // Install error handler that just prints the errors
674
- * function my_error_handler(source: unknown, message: unknown, traceback: unknown) {
675
- * print(source); //> lua
676
- * print(message); //> main/my.script:10: attempt to perform arithmetic on a string value
677
- * print(traceback); //> stack traceback:
678
- * //> main/test.script:10: in function 'boom'
679
- * //> main/test.script:15: in function <main/my.script:13>
680
- * }
681
- *
682
673
  * function boom() {
683
674
  * return 10 + "string";
684
675
  * }
685
676
  *
686
677
  * export default defineScript({
687
678
  * init() {
688
- * sys.set_error_handler(my_error_handler);
679
+ * // Install error handler that just prints the errors
680
+ * sys.set_error_handler((source, message, traceback) => {
681
+ * print(source); //> lua
682
+ * print(message); //> main/my.script:10: attempt to perform arithmetic on a string value
683
+ * print(traceback); //> stack traceback:
684
+ * //> main/test.script:10: in function 'boom'
685
+ * //> main/test.script:15: in function <main/my.script:13>
686
+ * });
689
687
  * boom();
690
688
  * },
691
689
  * });
@@ -299,7 +299,7 @@ declare global {
299
299
  * // Delete the script's own game object.
300
300
  * go.delete();
301
301
  * // Delete a game object with the id "my_game_object".
302
- * const id = go.get_id("my_game_object");
302
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
303
303
  * go.delete(id);
304
304
  * // Delete a list of game objects.
305
305
  * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
@@ -311,7 +311,7 @@ declare global {
311
311
  * // Delete the script's own game object and its children.
312
312
  * go.delete(true);
313
313
  * // Delete a game object with the id "my_game_object" and its children.
314
- * const id = go.get_id("my_game_object");
314
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
315
315
  * go.delete(id, true);
316
316
  * // Delete a list of game objects and their children.
317
317
  * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
@@ -1599,15 +1599,13 @@ declare global {
1599
1599
  * // How to play a particle fx when a gui node is created.
1600
1600
  * // The callback receives the gui node, the hash of the id
1601
1601
  * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
1602
- * function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
1603
- * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1604
- * // exhaust is done spawning particles...
1605
- * }
1606
- * }
1607
- *
1608
1602
  * export default defineGuiScript({
1609
1603
  * init(self) {
1610
- * gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
1604
+ * gui.play_particlefx(gui.get_node("particlefx"), (self, node, emitter, state) => {
1605
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1606
+ * // exhaust is done spawning particles...
1607
+ * }
1608
+ * });
1611
1609
  * },
1612
1610
  * });
1613
1611
  * ```
@@ -50,15 +50,13 @@ declare global {
50
50
  * // How to play a particle fx when a game object is created.
51
51
  * // The callback receives the hash of the path to the particlefx, the hash of the id
52
52
  * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
53
- * function emitter_state_change(self: unknown, id: unknown, emitter: unknown, state: unknown) {
54
- * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
55
- * // exhaust is done spawning particles...
56
- * }
57
- * }
58
- *
59
53
  * export default defineScript({
60
54
  * init(self) {
61
- * particlefx.play("#particlefx", emitter_state_change);
55
+ * particlefx.play("#particlefx", (self, id, emitter, state) => {
56
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
57
+ * // exhaust is done spawning particles...
58
+ * }
59
+ * });
62
60
  * },
63
61
  * });
64
62
  * ```
@@ -78,11 +78,16 @@ declare global {
78
78
  * @example
79
79
  * Then use the constant buffer when drawing a predicate:
80
80
  * ```ts
81
- * function draw_tinted(self: { my_pred: Opaque<"render_predicate"> }) {
82
- * const constants = render.constant_buffer();
83
- * constants.tint = vmath.vector4(1, 1, 1, 1);
84
- * render.draw(self.my_pred, { constants });
85
- * }
81
+ * export default defineRenderScript({
82
+ * init() {
83
+ * return { my_pred: render.predicate([hash("my_tag")]) };
84
+ * },
85
+ *
86
+ * update(self, dt) {
87
+ * const constants = render.constant_buffer();
88
+ * render.draw(self.my_pred, { constants });
89
+ * },
90
+ * });
86
91
  * ```
87
92
  * @example
88
93
  * The constant buffer also supports array values by specifying constants in a table:
@@ -457,13 +462,13 @@ declare global {
457
462
  * ```
458
463
  * @example
459
464
  * ```ts
460
- * // Or enable a render target by resource id:
461
465
  * export default defineRenderScript({
462
466
  * init() {
463
467
  * return { my_pred: render.predicate([hash("my_tag")]) };
464
468
  * },
465
469
  *
466
470
  * update(self, dt) {
471
+ * // enable render target by resource id
467
472
  * render.set_render_target("my_rt_resource");
468
473
  * render.draw(self.my_pred);
469
474
  * render.set_render_target(render.RENDER_TARGET_DEFAULT);
@@ -477,7 +482,6 @@ declare global {
477
482
  * ```
478
483
  * @example
479
484
  * ```ts
480
- * // Or bind a texture handle directly:
481
485
  * export default defineRenderScript({
482
486
  * init() {
483
487
  * return { my_texture_handle: resource.get_texture_info("/main/my_texture.texturec").handle };
@@ -520,15 +524,10 @@ declare global {
520
524
  * ```ts
521
525
  * export default defineRenderScript({
522
526
  * init() {
523
- * // render target buffer parameters
524
527
  * const color_params = {
525
528
  * format: graphics.TEXTURE_FORMAT_RGBA,
526
529
  * width: render.get_window_width(),
527
530
  * height: render.get_window_height(),
528
- * min_filter: graphics.TEXTURE_FILTER_LINEAR,
529
- * mag_filter: graphics.TEXTURE_FILTER_LINEAR,
530
- * u_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
531
- * v_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
532
531
  * };
533
532
  * return {
534
533
  * target_right: render.render_target("right", {
@@ -562,15 +561,10 @@ declare global {
562
561
  * ```ts
563
562
  * export default defineRenderScript({
564
563
  * init() {
565
- * // render target buffer parameters
566
564
  * const color_params = {
567
565
  * format: graphics.TEXTURE_FORMAT_RGBA,
568
566
  * width: render.get_window_width(),
569
567
  * height: render.get_window_height(),
570
- * min_filter: graphics.TEXTURE_FILTER_LINEAR,
571
- * mag_filter: graphics.TEXTURE_FILTER_LINEAR,
572
- * u_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
573
- * v_wrap: graphics.TEXTURE_WRAP_CLAMP_TO_EDGE,
574
568
  * };
575
569
  * return {
576
570
  * target_right: render.render_target("right", {
@@ -987,13 +981,13 @@ declare global {
987
981
  * ```
988
982
  * @example
989
983
  * ```ts
990
- * // Or set the render target by a render target resource identifier:
991
984
  * export default defineRenderScript({
992
985
  * init() {
993
986
  * return { my_pred: render.predicate([hash("my_tag")]) };
994
987
  * },
995
988
  *
996
989
  * update(self, dt) {
990
+ * // set render target by a render target resource identifier
997
991
  * render.set_render_target("my_rt_resource");
998
992
  *
999
993
  * // draw a predicate to the render target
@@ -605,22 +605,20 @@ declare global {
605
605
  * string The stack traceback.
606
606
  * @example
607
607
  * ```ts
608
- * // Install error handler that just prints the errors
609
- * function my_error_handler(source: unknown, message: unknown, traceback: unknown) {
610
- * print(source); //> lua
611
- * print(message); //> main/my.script:10: attempt to perform arithmetic on a string value
612
- * print(traceback); //> stack traceback:
613
- * //> main/test.script:10: in function 'boom'
614
- * //> main/test.script:15: in function <main/my.script:13>
615
- * }
616
- *
617
608
  * function boom() {
618
609
  * return 10 + "string";
619
610
  * }
620
611
  *
621
612
  * export default defineScript({
622
613
  * init() {
623
- * sys.set_error_handler(my_error_handler);
614
+ * // Install error handler that just prints the errors
615
+ * sys.set_error_handler((source, message, traceback) => {
616
+ * print(source); //> lua
617
+ * print(message); //> main/my.script:10: attempt to perform arithmetic on a string value
618
+ * print(traceback); //> stack traceback:
619
+ * //> main/test.script:10: in function 'boom'
620
+ * //> main/test.script:15: in function <main/my.script:13>
621
+ * });
624
622
  * boom();
625
623
  * },
626
624
  * });
@@ -127,23 +127,21 @@ declare global {
127
127
  * - number `height`: The height of a resize event. nil otherwise.
128
128
  * @example
129
129
  * ```ts
130
- * function window_callback(self: unknown, event: unknown, data: Record<string | number, unknown>) {
131
- * if (event === window.WINDOW_EVENT_FOCUS_LOST) {
132
- * print("window.WINDOW_EVENT_FOCUS_LOST");
133
- * } else if (event === window.WINDOW_EVENT_FOCUS_GAINED) {
134
- * print("window.WINDOW_EVENT_FOCUS_GAINED");
135
- * } else if (event === window.WINDOW_EVENT_ICONFIED) {
136
- * print("window.WINDOW_EVENT_ICONFIED");
137
- * } else if (event === window.WINDOW_EVENT_DEICONIFIED) {
138
- * print("window.WINDOW_EVENT_DEICONIFIED");
139
- * } else if (event === window.WINDOW_EVENT_RESIZED) {
140
- * print("Window resized: ", data.width, data.height);
141
- * }
142
- * }
143
- *
144
130
  * export default defineScript({
145
131
  * init() {
146
- * window.set_listener(window_callback);
132
+ * window.set_listener((self, event, data) => {
133
+ * if (event === window.WINDOW_EVENT_FOCUS_LOST) {
134
+ * print("window.WINDOW_EVENT_FOCUS_LOST");
135
+ * } else if (event === window.WINDOW_EVENT_FOCUS_GAINED) {
136
+ * print("window.WINDOW_EVENT_FOCUS_GAINED");
137
+ * } else if (event === window.WINDOW_EVENT_ICONFIED) {
138
+ * print("window.WINDOW_EVENT_ICONFIED");
139
+ * } else if (event === window.WINDOW_EVENT_DEICONIFIED) {
140
+ * print("window.WINDOW_EVENT_DEICONIFIED");
141
+ * } else if (event === window.WINDOW_EVENT_RESIZED) {
142
+ * print("Window resized: ", data.width, data.height);
143
+ * }
144
+ * });
147
145
  * },
148
146
  * });
149
147
  * ```
@@ -135,10 +135,32 @@ declare global {
135
135
  * ```ts
136
136
  * const body = b2d.get_body("#collisionobject");
137
137
  * if (body !== undefined) {
138
+ * // Move a circle shape relative to the body origin.
138
139
  * const circle = b2d.fixture.get_shape(body, 1);
139
140
  * const radius = "radius" in circle ? circle.radius : undefined;
140
141
  * b2d.fixture.set_shape(body, 1, { type: b2d.shape.SHAPE_TYPE_CIRCLE, radius: radius ?? 16, center: vmath.vector3(24, 0, 0) }, true);
141
- * b2d.fixture.set_shape(body, 2, { type: b2d.shape.SHAPE_TYPE_EDGE, v1: vmath.vector3(-32, 0, 0), v2: vmath.vector3(32, 0, 0) });
142
+ *
143
+ * // Replace an edge shape's local endpoints.
144
+ * b2d.fixture.set_shape(body, 2, {
145
+ * type: b2d.shape.SHAPE_TYPE_EDGE,
146
+ * v1: vmath.vector3(-32, 0, 0),
147
+ * v2: vmath.vector3(32, 0, 0),
148
+ * });
149
+ *
150
+ * // Update a box shape using the polygon box convenience format.
151
+ * // The existing polygon must already have four vertices.
152
+ * b2d.fixture.set_shape(
153
+ * body,
154
+ * 3,
155
+ * {
156
+ * type: b2d.shape.SHAPE_TYPE_BOX,
157
+ * hx: 16,
158
+ * hy: 8,
159
+ * center: vmath.vector3(0, 20, 0),
160
+ * angle: math.rad(30),
161
+ * },
162
+ * true,
163
+ * );
142
164
  * }
143
165
  * ```
144
166
  */
@@ -375,10 +375,31 @@ declare global {
375
375
  * ```ts
376
376
  * const body = b2d.get_body("#collisionobject");
377
377
  * if (body !== undefined) {
378
+ * // Move a circle shape relative to the body origin.
378
379
  * const circle = b2d.shape.get_shape(body, 1);
379
380
  * const radius = "radius" in circle ? circle.radius : undefined;
380
381
  * b2d.shape.set_shape(body, 1, { type: b2d.shape.SHAPE_TYPE_CIRCLE, radius: radius ?? 16, center: vmath.vector3(24, 0, 0) }, true);
381
- * b2d.shape.set_shape(body, 2, { type: b2d.shape.SHAPE_TYPE_SEGMENT, v1: vmath.vector3(-32, 0, 0), v2: vmath.vector3(32, 0, 0) });
382
+ *
383
+ * // Replace a segment shape's local endpoints.
384
+ * b2d.shape.set_shape(body, 2, {
385
+ * type: b2d.shape.SHAPE_TYPE_SEGMENT,
386
+ * v1: vmath.vector3(-32, 0, 0),
387
+ * v2: vmath.vector3(32, 0, 0),
388
+ * });
389
+ *
390
+ * // Update a box shape using the polygon box convenience format.
391
+ * b2d.shape.set_shape(
392
+ * body,
393
+ * 3,
394
+ * {
395
+ * type: b2d.shape.SHAPE_TYPE_BOX,
396
+ * hx: 16,
397
+ * hy: 8,
398
+ * center: vmath.vector3(0, 20, 0),
399
+ * angle: math.rad(30),
400
+ * },
401
+ * true,
402
+ * );
382
403
  * }
383
404
  * ```
384
405
  */
@@ -167,7 +167,23 @@ declare global {
167
167
  * vmath.vector4 | vmath.vector3 | vmath.matrix4 | number | table the value(s) of the constant. If the shader constant is an array, the amount of values to update depends on how many values that are passed in the 'value' field.
168
168
  * @example
169
169
  * ```ts
170
- * compute.set_constants("/my_compute.computec", { tint: { value: vmath.vector4(1, 0, 0, 1) } });
170
+ * // Set a shader constant in a compute program
171
+ * export default defineScript({
172
+ * init() {
173
+ * return { my_view_proj: vmath.matrix4() };
174
+ * },
175
+ *
176
+ * update(self) {
177
+ * // update the 'tint' constant
178
+ * compute.set_constants("/my_compute.computec", {
179
+ * tint: { value: vmath.vector4(1, 0, 0, 1) },
180
+ * });
181
+ * // change the type of the 'view_proj' constant to CONSTANT_TYPE_USER_MATRIX4 so the renderer can set our custom data
182
+ * compute.set_constants("/my_compute.computec", {
183
+ * view_proj: { value: self.my_view_proj, type: material.CONSTANT_TYPE_USER_MATRIX4 },
184
+ * });
185
+ * },
186
+ * });
171
187
  * ```
172
188
  */
173
189
  function set_constants(path: Hash | string, constants: Record<string, { type?: number; value?: Vector4 | Vector3 | Matrix4 | number | (Vector4 | Matrix4)[] }>): void;
@@ -227,7 +243,18 @@ declare global {
227
243
  * @param textures - A table keyed by sampler name with texture resources as values.
228
244
  * @example
229
245
  * ```ts
230
- * compute.set_textures("/my_compute.computec", { my_texture: resource.texture() });
246
+ * // Set a texture in a compute program from a resource
247
+ * export default defineScript({
248
+ * // Never call `go.property` yourself: the transpiler emits the chunk-scope
249
+ * // registration from this field, and only this field types the property onto `self`.
250
+ * properties: { my_texture: resource.texture() },
251
+ *
252
+ * init(self) {
253
+ * compute.set_textures("/my_compute.computec", {
254
+ * my_texture: self.my_texture,
255
+ * });
256
+ * },
257
+ * });
231
258
  * ```
232
259
  */
233
260
  function set_textures(path: Hash | string, textures: LuaMap<string, Hash> | Record<string, Hash>): void;
@@ -297,7 +297,7 @@ declare global {
297
297
  * // Delete the script's own game object.
298
298
  * go.delete();
299
299
  * // Delete a game object with the id "my_game_object".
300
- * const id = go.get_id("my_game_object");
300
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
301
301
  * go.delete(id);
302
302
  * // Delete a list of game objects.
303
303
  * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
@@ -309,7 +309,7 @@ declare global {
309
309
  * // Delete the script's own game object and its children.
310
310
  * go.delete(true);
311
311
  * // Delete a game object with the id "my_game_object" and its children.
312
- * const id = go.get_id("my_game_object");
312
+ * const id = go.get_id("my_game_object"); // retrieve the id of the game object to be deleted
313
313
  * go.delete(id, true);
314
314
  * // Delete a list of game objects and their children.
315
315
  * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
@@ -1597,15 +1597,13 @@ declare global {
1597
1597
  * // How to play a particle fx when a gui node is created.
1598
1598
  * // The callback receives the gui node, the hash of the id
1599
1599
  * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
1600
- * function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
1601
- * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1602
- * // exhaust is done spawning particles...
1603
- * }
1604
- * }
1605
- *
1606
1600
  * export default defineGuiScript({
1607
1601
  * init(self) {
1608
- * gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
1602
+ * gui.play_particlefx(gui.get_node("particlefx"), (self, node, emitter, state) => {
1603
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1604
+ * // exhaust is done spawning particles...
1605
+ * }
1606
+ * });
1609
1607
  * },
1610
1608
  * });
1611
1609
  * ```