@defold-typescript/types 0.5.3 → 0.5.5

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/generated/go.d.ts CHANGED
@@ -226,27 +226,22 @@ declare global {
226
226
  * `property`
227
227
  * hash The id of the animated property.
228
228
  * @example
229
- * ```lua
230
- * Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
231
- * local function x_done(self, url, property)
232
- * go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1)
233
- * end
234
- *
235
- * function init(self)
236
- * go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, x_done)
237
- * end
238
- *
239
- * Animate the y position of a game object using a crazy custom easing curve:
240
- * local values = { 0, 0, 0, 0, 0, 0, 0, 0,
241
- * 1, 1, 1, 1, 1, 1, 1, 1,
242
- * 0, 0, 0, 0, 0, 0, 0, 0,
243
- * 1, 1, 1, 1, 1, 1, 1, 1,
244
- * 0, 0, 0, 0, 0, 0, 0, 0,
245
- * 1, 1, 1, 1, 1, 1, 1, 1,
246
- * 0, 0, 0, 0, 0, 0, 0, 0,
247
- * 1, 1, 1, 1, 1, 1, 1, 1 }
248
- * local vec = vmath.vector(values)
249
- * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0)
229
+ * ```ts
230
+ * // Animate the position of a game object to x = 10 during 1 second, then
231
+ * // y = 20 during 1 second:
232
+ * go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
233
+ * go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
234
+ * });
235
+ *
236
+ * // Animate the y position of a game object using a crazy custom easing curve:
237
+ * const values = [
238
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
239
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
240
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
241
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
242
+ * ];
243
+ * const vec = vmath.vector(values);
244
+ * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
250
245
  * ```
251
246
  */
252
247
  export function animate(url: string | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
@@ -257,15 +252,15 @@ declare global {
257
252
  * @param url - url of the game object or component
258
253
  * @param property - optional id of the property to cancel
259
254
  * @example
260
- * ```lua
261
- * Cancel the animation of the position of a game object:
262
- * go.cancel_animations(go.get_id(), "position")
255
+ * ```ts
256
+ * // Cancel the animation of the position of a game object:
257
+ * go.cancel_animations(go.get_id(), "position");
263
258
  *
264
- * Cancel all property animations of the current game object:
265
- * go.cancel_animations(".")
259
+ * // Cancel all property animations of the current game object:
260
+ * go.cancel_animations(".");
266
261
  *
267
- * Cancel all property animations of the sprite component of the current game object:
268
- * go.cancel_animations("#sprite")
262
+ * // Cancel all property animations of the sprite component of the current game object:
263
+ * go.cancel_animations("#sprite");
269
264
  * ```
270
265
  */
271
266
  export function cancel_animations(url: string | Hash | Url, property?: string | Hash): void;
@@ -280,26 +275,27 @@ declare global {
280
275
  * @param id - optional id or table of id's of the instance(s) to delete, the instance of the calling script is deleted by default
281
276
  * @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
282
277
  * @example
283
- * ```lua
284
- * This example demonstrates how to delete game objects
285
- * -- Delete the script game object
286
- * go.delete()
287
- * -- Delete a game object with the id "my_game_object".
288
- * local id = go.get_id("my_game_object") -- retrieve the id of the game object to be deleted
289
- * go.delete(id)
290
- * -- Delete a list of game objects.
291
- * local ids = { hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3") }
292
- * go.delete(ids)
293
- *
294
- * This example demonstrates how to delete a game objects and their children (child to parent order)
295
- * -- Delete the script game object and it's children
296
- * go.delete(true)
297
- * -- Delete a game object with the id "my_game_object" and it's children.
298
- * local id = go.get_id("my_game_object") -- retrieve the id of the game object to be deleted
299
- * go.delete(id, true)
300
- * -- Delete a list of game objects and their children.
301
- * local ids = { hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3") }
302
- * go.delete(ids, true)
278
+ * ```ts
279
+ * // This example demonstrates how to delete game objects:
280
+ * // Delete the script's own game object.
281
+ * go.delete();
282
+ * // Delete a game object with the id "my_game_object".
283
+ * const id = go.get_id("my_game_object");
284
+ * go.delete(id);
285
+ * // Delete a list of game objects.
286
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
287
+ * go.delete(ids);
288
+ *
289
+ * // This example demonstrates how to delete game objects and their children
290
+ * // (child-to-parent order):
291
+ * // Delete the script's own game object and its children.
292
+ * go.delete(true);
293
+ * // Delete a game object with the id "my_game_object" and its children.
294
+ * const id2 = go.get_id("my_game_object");
295
+ * go.delete(id2, true);
296
+ * // Delete a list of game objects and their children.
297
+ * const ids2 = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
298
+ * go.delete(ids2, true);
303
299
  * ```
304
300
  */
305
301
  function _delete(id?: string | Hash | Url | (string | Hash | Url)[], recursive?: boolean): void;
@@ -310,12 +306,12 @@ declare global {
310
306
  * @param url - url of the game object to check
311
307
  * @returns true if the game object exists
312
308
  * @example
313
- * ```lua
314
- * Check if game object "my_game_object" exists in the current collection
315
- * go.exists("/my_game_object")
309
+ * ```ts
310
+ * // Check if game object "my_game_object" exists in the current collection:
311
+ * go.exists("/my_game_object");
316
312
  *
317
- * Check if game object exists in another collection
318
- * go.exists("other_collection:/my_game_object")
313
+ * // Check if game object exists in another collection:
314
+ * go.exists("other_collection:/my_game_object");
319
315
  * ```
320
316
  */
321
317
  export function exists(url: string | Hash | Url): boolean;
@@ -353,16 +349,17 @@ declare global {
353
349
  * @param path - path of the instance for which to return the id
354
350
  * @returns instance id
355
351
  * @example
356
- * ```lua
357
- * For the instance with path /my_sub_collection/my_instance, the following calls are equivalent:
358
- * local id = go.get_id() -- no path, defaults to the instance containing the calling script
359
- * print(id) --> hash: [/my_sub_collection/my_instance]
352
+ * ```ts
353
+ * // For the instance with path /my_sub_collection/my_instance, the following calls
354
+ * // are equivalent:
355
+ * const id = go.get_id(); // no path, defaults to the instance containing the calling script
356
+ * print(id); // => hash: [/my_sub_collection/my_instance]
360
357
  *
361
- * local id = go.get_id("/my_sub_collection/my_instance") -- absolute path
362
- * print(id) --> hash: [/my_sub_collection/my_instance]
358
+ * const id2 = go.get_id("/my_sub_collection/my_instance"); // absolute path
359
+ * print(id2); // => hash: [/my_sub_collection/my_instance]
363
360
  *
364
- * local id = go.get_id("my_instance") -- relative path
365
- * print(id) --> hash: [/my_sub_collection/my_instance]
361
+ * const id3 = go.get_id("my_instance"); // relative path
362
+ * print(id3); // => hash: [/my_sub_collection/my_instance]
366
363
  * ```
367
364
  */
368
365
  export function get_id(path?: string): Hash;
@@ -372,12 +369,12 @@ declare global {
372
369
  * @param id - optional id of the game object instance to get parent for, defaults to the instance containing the calling script
373
370
  * @returns parent instance or `nil`
374
371
  * @example
375
- * ```lua
376
- * Get parent of the instance containing the calling script:
377
- * local parent_id = go.get_parent()
372
+ * ```ts
373
+ * // Get parent of the instance containing the calling script:
374
+ * const parent_id = go.get_parent();
378
375
  *
379
- * Get parent of the instance with id "x":
380
- * local parent_id = go.get_parent("x")
376
+ * // Get parent of the instance with id "x":
377
+ * const parent_id2 = go.get_parent("x");
381
378
  * ```
382
379
  */
383
380
  export function get_parent(id?: string | Hash | Url): Hash | unknown;
@@ -387,12 +384,12 @@ declare global {
387
384
  * @param id - optional id of the game object instance to get the position for, by default the instance of the calling script
388
385
  * @returns instance position
389
386
  * @example
390
- * ```lua
391
- * Get the position of the game object instance the script is attached to:
392
- * local p = go.get_position()
387
+ * ```ts
388
+ * // Get the position of the game object the script is attached to:
389
+ * const p = go.get_position();
393
390
  *
394
- * Get the position of another game object instance "my_gameobject":
395
- * local pos = go.get_position("my_gameobject")
391
+ * // Get the position of another game object "my_gameobject":
392
+ * const pos = go.get_position("my_gameobject");
396
393
  * ```
397
394
  */
398
395
  export function get_position(id?: string | Hash | Url): Vector3;
@@ -402,12 +399,12 @@ declare global {
402
399
  * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
403
400
  * @returns instance rotation
404
401
  * @example
405
- * ```lua
406
- * Get the rotation of the game object instance the script is attached to:
407
- * local r = go.get_rotation()
402
+ * ```ts
403
+ * // Get the rotation of the game object the script is attached to:
404
+ * const r = go.get_rotation();
408
405
  *
409
- * Get the rotation of another game object instance with id "x":
410
- * local r = go.get_rotation("x")
406
+ * // Get the rotation of another game object with id "x":
407
+ * const r2 = go.get_rotation("x");
411
408
  * ```
412
409
  */
413
410
  export function get_rotation(id?: string | Hash | Url): Quaternion;
@@ -417,12 +414,12 @@ declare global {
417
414
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
418
415
  * @returns instance scale factor
419
416
  * @example
420
- * ```lua
421
- * Get the scale of the game object instance the script is attached to:
422
- * local s = go.get_scale()
417
+ * ```ts
418
+ * // Get the scale of the game object the script is attached to:
419
+ * const s = go.get_scale();
423
420
  *
424
- * Get the scale of another game object instance with id "x":
425
- * local s = go.get_scale("x")
421
+ * // Get the scale of another game object with id "x":
422
+ * const s2 = go.get_scale("x");
426
423
  * ```
427
424
  */
428
425
  export function get_scale(id?: string | Hash | Url): Vector3;
@@ -432,12 +429,12 @@ declare global {
432
429
  * @param id - optional id of the game object instance to get the uniform scale for, by default the instance of the calling script
433
430
  * @returns uniform instance scale factor
434
431
  * @example
435
- * ```lua
436
- * Get the scale of the game object instance the script is attached to:
437
- * local s = go.get_scale_uniform()
432
+ * ```ts
433
+ * // Get the uniform scale of the game object the script is attached to:
434
+ * const s = go.get_scale_uniform();
438
435
  *
439
- * Get the uniform scale of another game object instance with id "x":
440
- * local s = go.get_scale_uniform("x")
436
+ * // Get the uniform scale of another game object with id "x":
437
+ * const s2 = go.get_scale_uniform("x");
441
438
  * ```
442
439
  */
443
440
  export function get_scale_uniform(id?: string | Hash | Url): number;
@@ -449,12 +446,12 @@ declare global {
449
446
  * @param id - optional id of the game object instance to get the world position for, by default the instance of the calling script
450
447
  * @returns instance world position
451
448
  * @example
452
- * ```lua
453
- * Get the world position of the game object instance the script is attached to:
454
- * local p = go.get_world_position()
449
+ * ```ts
450
+ * // Get the world position of the game object the script is attached to:
451
+ * const p = go.get_world_position();
455
452
  *
456
- * Get the world position of another game object instance with id "x":
457
- * local p = go.get_world_position("x")
453
+ * // Get the world position of another game object with id "x":
454
+ * const p2 = go.get_world_position("x");
458
455
  * ```
459
456
  */
460
457
  export function get_world_position(id?: string | Hash | Url): Vector3;
@@ -466,12 +463,12 @@ declare global {
466
463
  * @param id - optional id of the game object instance to get the world rotation for, by default the instance of the calling script
467
464
  * @returns instance world rotation
468
465
  * @example
469
- * ```lua
470
- * Get the world rotation of the game object instance the script is attached to:
471
- * local r = go.get_world_rotation()
466
+ * ```ts
467
+ * // Get the world rotation of the game object the script is attached to:
468
+ * const r = go.get_world_rotation();
472
469
  *
473
- * Get the world rotation of another game object instance with id "x":
474
- * local r = go.get_world_rotation("x")
470
+ * // Get the world rotation of another game object with id "x":
471
+ * const r2 = go.get_world_rotation("x");
475
472
  * ```
476
473
  */
477
474
  export function get_world_rotation(id?: string | Hash | Url): Quaternion;
@@ -485,12 +482,12 @@ declare global {
485
482
  * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
486
483
  * @returns instance world 3D scale factor
487
484
  * @example
488
- * ```lua
489
- * Get the world 3D scale of the game object instance the script is attached to:
490
- * local s = go.get_world_scale()
485
+ * ```ts
486
+ * // Get the world 3D scale of the game object the script is attached to:
487
+ * const s = go.get_world_scale();
491
488
  *
492
- * Get the world scale of another game object instance "x":
493
- * local s = go.get_world_scale("x")
489
+ * // Get the world scale of another game object "x":
490
+ * const s2 = go.get_world_scale("x");
494
491
  * ```
495
492
  */
496
493
  export function get_world_scale(id?: string | Hash | Url): Vector3;
@@ -502,12 +499,12 @@ declare global {
502
499
  * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
503
500
  * @returns instance world scale factor
504
501
  * @example
505
- * ```lua
506
- * Get the world scale of the game object instance the script is attached to:
507
- * local s = go.get_world_scale_uniform()
502
+ * ```ts
503
+ * // Get the world uniform scale of the game object the script is attached to:
504
+ * const s = go.get_world_scale_uniform();
508
505
  *
509
- * Get the world scale of another game object instance with id "x":
510
- * local s = go.get_world_scale_uniform("x")
506
+ * // Get the world uniform scale of another game object with id "x":
507
+ * const s2 = go.get_world_scale_uniform("x");
511
508
  * ```
512
509
  */
513
510
  export function get_world_scale_uniform(id?: string | Hash | Url): number;
@@ -518,12 +515,12 @@ declare global {
518
515
  * @param id - optional id of the game object instance to get the world transform for, by default the instance of the calling script
519
516
  * @returns instance world transform
520
517
  * @example
521
- * ```lua
522
- * Get the world transform of the game object instance the script is attached to:
523
- * local m = go.get_world_transform()
518
+ * ```ts
519
+ * // Get the world transform of the game object the script is attached to:
520
+ * const m = go.get_world_transform();
524
521
  *
525
- * Get the world transform of another game object instance with id "x":
526
- * local m = go.get_world_transform("x")
522
+ * // Get the world transform of another game object with id "x":
523
+ * const m2 = go.get_world_transform("x");
527
524
  * ```
528
525
  */
529
526
  export function get_world_transform(id?: string | Hash | Url): Matrix4;
@@ -763,22 +760,24 @@ declare global {
763
760
  * @param name - the id of the property
764
761
  * @param value - default value of the property. In the case of a url, only the empty constructor msg.url() is allowed. In the case of a resource one of the resource constructors (eg resource.atlas(), resource.font() etc) is expected.
765
762
  * @example
766
- * ```lua
767
- * This example demonstrates how to define a property called "health" in a script.
768
- * The health is decreased whenever someone sends a message called "take_damage" to the script.
769
- * go.property("health", 100)
770
- *
771
- * function init(self)
772
- * -- prints 100 to the output
773
- * print(self.health)
774
- * end
775
- *
776
- * function on_message(self, message_id, message, sender)
777
- * if message_id == hash("take_damage") then
778
- * self.health = self.health - message.damage
779
- * print("Ouch! My health is now: " .. self.health)
780
- * end
781
- * end
763
+ * ```ts
764
+ * // This example defines a property "health" in a script. The health is decreased
765
+ * // whenever someone sends a "take_damage" message to the script.
766
+ * go.property("health", 100);
767
+ *
768
+ * export default defineScript({
769
+ * init(self) {
770
+ * // prints 100 to the output
771
+ * print(self.health);
772
+ * },
773
+ *
774
+ * on_message(self, message_id, message) {
775
+ * if (message_id === hash("take_damage")) {
776
+ * self.health = self.health - message.damage;
777
+ * print(`Ouch! My health is now: ${self.health}`);
778
+ * }
779
+ * },
780
+ * });
782
781
  * ```
783
782
  */
784
783
  export function property(name: string, value: number | Hash | Url | Vector3 | Vector4 | Quaternion | Opaque<"resource"> | boolean): void;
@@ -794,15 +793,15 @@ declare global {
794
793
  * @param parent_id - optional id of the new parent game object, defaults to detaching game object from its parent
795
794
  * @param keep_world_transform - optional boolean, set to true to maintain the world transform when changing spaces. Defaults to false.
796
795
  * @example
797
- * ```lua
798
- * Attach myself to another instance "my_parent":
799
- * go.set_parent(go.get_id(),go.get_id("my_parent"))
796
+ * ```ts
797
+ * // Attach myself to another instance "my_parent":
798
+ * go.set_parent(go.get_id(), go.get_id("my_parent"));
800
799
  *
801
- * Attach an instance "my_instance" to another instance "my_parent":
802
- * go.set_parent(go.get_id("my_instance"),go.get_id("my_parent"))
800
+ * // Attach an instance "my_instance" to another instance "my_parent":
801
+ * go.set_parent(go.get_id("my_instance"), go.get_id("my_parent"));
803
802
  *
804
- * Detach an instance "my_instance" from its parent (if any):
805
- * go.set_parent(go.get_id("my_instance"))
803
+ * // Detach an instance "my_instance" from its parent (if any):
804
+ * go.set_parent(go.get_id("my_instance"));
806
805
  * ```
807
806
  */
808
807
  export function set_parent(id?: string | Hash | Url, parent_id?: string | Hash | Url, keep_world_transform?: boolean): void;
@@ -812,14 +811,15 @@ declare global {
812
811
  * @param position - position to set
813
812
  * @param id - optional id of the game object instance to set the position for, by default the instance of the calling script
814
813
  * @example
815
- * ```lua
816
- * Set the position of the game object instance the script is attached to:
817
- * local p = ...
818
- * go.set_position(p)
814
+ * ```ts
815
+ * // `p` is the desired position (a Vector3).
816
+ * const p = vmath.vector3();
819
817
  *
820
- * Set the position of another game object instance with id "x":
821
- * local p = ...
822
- * go.set_position(p, "x")
818
+ * // Set the position of the game object the script is attached to:
819
+ * go.set_position(p);
820
+ *
821
+ * // Set the position of another game object with id "x":
822
+ * go.set_position(p, "x");
823
823
  * ```
824
824
  */
825
825
  export function set_position(position: Vector3, id?: string | Hash | Url): void;
@@ -829,14 +829,15 @@ declare global {
829
829
  * @param rotation - rotation to set
830
830
  * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
831
831
  * @example
832
- * ```lua
833
- * Set the rotation of the game object instance the script is attached to:
834
- * local r = ...
835
- * go.set_rotation(r)
832
+ * ```ts
833
+ * // `r` is the desired rotation (a Quaternion).
834
+ * const r = vmath.quat();
835
+ *
836
+ * // Set the rotation of the game object the script is attached to:
837
+ * go.set_rotation(r);
836
838
  *
837
- * Set the rotation of another game object instance with id "x":
838
- * local r = ...
839
- * go.set_rotation(r, "x")
839
+ * // Set the rotation of another game object with id "x":
840
+ * go.set_rotation(r, "x");
840
841
  * ```
841
842
  */
842
843
  export function set_rotation(rotation: Quaternion, id?: string | Hash | Url): void;
@@ -847,14 +848,14 @@ declare global {
847
848
  * @param scale - vector or uniform scale factor, must be greater than 0
848
849
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
849
850
  * @example
850
- * ```lua
851
- * Set the scale of the game object instance the script is attached to:
852
- * local s = vmath.vector3(2.0, 1.0, 1.0)
853
- * go.set_scale(s)
854
- *
855
- * Set the scale of another game object instance with id "obj_id":
856
- * local s = 1.2
857
- * go.set_scale(s, "obj_id")
851
+ * ```ts
852
+ * // Set the scale of the game object the script is attached to:
853
+ * const s = vmath.vector3(2.0, 1.0, 1.0);
854
+ * go.set_scale(s);
855
+ *
856
+ * // Set the scale of another game object with id "obj_id":
857
+ * const s2 = 1.2;
858
+ * go.set_scale(s2, "obj_id");
858
859
  * ```
859
860
  */
860
861
  export function set_scale(scale: number | Vector3, id?: string | Hash | Url): void;
@@ -865,14 +866,14 @@ declare global {
865
866
  * @param scale - vector or uniform scale factor, must be greater than 0
866
867
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
867
868
  * @example
868
- * ```lua
869
- * Set the scale of the game object instance the script is attached to:
870
- * local s = vmath.vector3(2.0, 1.0, 5.0)
871
- * go.set_scale_xy(s) -- z will not be set here, only x and y
872
- *
873
- * Set the scale of another game object instance with id "obj_id":
874
- * local s = 1.2
875
- * go.set_scale_xy(s, "obj_id") -- z will not be set here, only x and y
869
+ * ```ts
870
+ * // Set the scale of the game object the script is attached to:
871
+ * const s = vmath.vector3(2.0, 1.0, 5.0);
872
+ * go.set_scale_xy(s); // z will not be set here, only x and y
873
+ *
874
+ * // Set the scale of another game object with id "obj_id":
875
+ * const s2 = 1.2;
876
+ * go.set_scale_xy(s2, "obj_id"); // z will not be set here, only x and y
876
877
  * ```
877
878
  */
878
879
  export function set_scale_xy(scale: number | Vector3, id?: string | Hash | Url): void;
@@ -908,12 +909,12 @@ declare global {
908
909
  *
909
910
  * @param id - optional id of the game object instance to update
910
911
  * @example
911
- * ```lua
912
- * Update this game object's world transform:
913
- * go.update_world_transform()
912
+ * ```ts
913
+ * // Update this game object's world transform:
914
+ * go.update_world_transform();
914
915
  *
915
- * Update another game object's world transform:
916
- * go.update_world_transform("/other")
916
+ * // Update another game object's world transform:
917
+ * go.update_world_transform("/other");
917
918
  * ```
918
919
  */
919
920
  export function update_world_transform(id?: string | Hash | Url): void;
@@ -924,11 +925,11 @@ declare global {
924
925
  * @param url - url of the game object which coordinate system convert to
925
926
  * @returns converted position
926
927
  * @example
927
- * ```lua
928
- * Convert position of "test" game object into coordinate space of "child" object.
929
- * local test_pos = go.get_world_position("/test")
930
- * local child_pos = go.get_world_position("/child")
931
- * local new_position = go.world_to_local_position(test_pos, "/child")
928
+ * ```ts
929
+ * // Convert position of "test" game object into coordinate space of "child" object.
930
+ * const test_pos = go.get_world_position("/test");
931
+ * const child_pos = go.get_world_position("/child");
932
+ * const new_position = go.world_to_local_position(test_pos, "/child");
932
933
  * ```
933
934
  */
934
935
  export function world_to_local_position(position: Vector3, url: string | Hash | Url): Vector3;
@@ -939,11 +940,11 @@ declare global {
939
940
  * @param url - url of the game object which coordinate system convert to
940
941
  * @returns converted transformation
941
942
  * @example
942
- * ```lua
943
- * Convert transformation of "test" game object into coordinate space of "child" object.
944
- * local test_transform = go.get_world_transform("/test")
945
- * local child_transform = go.get_world_transform("/child")
946
- * local result_transform = go.world_to_local_transform(test_transform, "/child")
943
+ * ```ts
944
+ * // Convert transform of "test" game object into coordinate space of "child" object.
945
+ * const test_transform = go.get_world_transform("/test");
946
+ * const child_transform = go.get_world_transform("/child");
947
+ * const result_transform = go.world_to_local_transform(test_transform, "/child");
947
948
  * ```
948
949
  */
949
950
  export function world_to_local_transform(transformation: Matrix4, url: string | Hash | Url): Matrix4;
@@ -49,16 +49,16 @@ declare global {
49
49
  * @param fragment - fragment of the URL
50
50
  * @returns a new URL
51
51
  * @example
52
- * ```lua
53
- * local my_socket = "main" -- specify by valid name
54
- * local my_path = hash("/my_collection/my_gameobject") -- specify as string or hash
55
- * local my_fragment = "component" -- specify as string or hash
56
- * local my_url = msg.url(my_socket, my_path, my_fragment)
52
+ * ```ts
53
+ * const my_socket = "main"; // specify by valid name
54
+ * const my_path = hash("/my_collection/my_gameobject"); // specify as string or hash
55
+ * const my_fragment = "component"; // specify as string or hash
56
+ * const my_url = msg.url(my_socket, my_path, my_fragment);
57
57
  *
58
- * print(my_url) --> url: [main:/my_collection/my_gameobject#component]
59
- * print(my_url.socket) --> 786443 (internal numeric value)
60
- * print(my_url.path) --> hash: [/my_collection/my_gameobject]
61
- * print(my_url.fragment) --> hash: [component]
58
+ * print(my_url); // => url: [main:/my_collection/my_gameobject#component]
59
+ * print(my_url.socket); // => 786443 (internal numeric value)
60
+ * print(my_url.path); // => hash: [/my_collection/my_gameobject]
61
+ * print(my_url.fragment); // => hash: [component]
62
62
  * ```
63
63
  */
64
64
  function url(socket?: string | Hash, path?: string | Hash, fragment?: string | Hash): Url;