@defold-typescript/types 0.19.4 → 0.20.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 (86) hide show
  1. package/api-availability.json +2755 -0
  2. package/api-migrations.json +31 -0
  3. package/api-signatures.json +2324 -0
  4. package/api-targets.json +493 -45
  5. package/generated/b2d.d.ts +6 -0
  6. package/generated/b2d_body.d.ts +329 -1
  7. package/generated/b2d_chain.d.ts +106 -0
  8. package/generated/b2d_fixture.d.ts +155 -0
  9. package/generated/b2d_joint.d.ts +823 -0
  10. package/generated/b2d_shape.d.ts +215 -0
  11. package/generated/b2d_world.d.ts +314 -0
  12. package/generated/builtin-messages.d.ts +18 -0
  13. package/generated/camera.d.ts +62 -5
  14. package/generated/compute.d.ts +306 -0
  15. package/generated/go.d.ts +29 -4
  16. package/generated/graphics.d.ts +95 -0
  17. package/generated/gui.d.ts +1 -3
  18. package/generated/json.d.ts +2 -2
  19. package/generated/kinds/gui-script.d.ts +7 -0
  20. package/generated/kinds/render-script.d.ts +7 -0
  21. package/generated/kinds/script.d.ts +7 -0
  22. package/generated/label.d.ts +1 -1
  23. package/generated/liveupdate.d.ts +22 -4
  24. package/generated/material.d.ts +444 -0
  25. package/generated/model.d.ts +46 -5
  26. package/generated/physics.d.ts +1 -3
  27. package/generated/profiler.d.ts +2 -3
  28. package/generated/render.d.ts +25 -9
  29. package/generated/resource.d.ts +2 -2
  30. package/generated/sprite.d.ts +15 -1
  31. package/generated/tilemap.d.ts +14 -0
  32. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  33. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  34. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  35. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  36. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  37. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  38. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  39. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  40. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  41. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  42. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  43. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  44. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  45. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  46. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  47. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  48. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  49. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  50. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  51. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  52. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  53. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  54. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  57. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  58. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  59. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  60. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  61. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  64. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  66. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  68. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  71. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  72. package/index.d.ts +22 -0
  73. package/package.json +8 -1
  74. package/scripts/fidelity-audit.ts +69 -12
  75. package/scripts/fidelity-baseline.json +56 -0
  76. package/scripts/generate-api-availability.ts +139 -0
  77. package/scripts/generate-api-signatures.ts +66 -0
  78. package/scripts/import-defold-release.ts +480 -0
  79. package/scripts/regen.ts +53 -6
  80. package/scripts/sync-api-docs.ts +89 -41
  81. package/src/api-availability.ts +0 -0
  82. package/src/core-types.ts +9 -0
  83. package/src/emit-dts.ts +674 -17
  84. package/src/emit-messages.ts +72 -2
  85. package/src/index.ts +26 -1
  86. package/src/lifecycle.ts +43 -2
@@ -0,0 +1,245 @@
1
+ /** @noSelfInFile */
2
+ import type { Matrix4, Url, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Camera functions, messages and constants.
7
+ */
8
+ namespace camera {
9
+ /**
10
+ * Computes zoom so the original display area covers the entire window while preserving aspect ratio.
11
+ * Equivalent to using max(window_width/width, window_height/height).
12
+ */
13
+ const ORTHO_MODE_AUTO_COVER: number & { readonly __brand: "camera.ORTHO_MODE_AUTO_COVER" };
14
+ /**
15
+ * Computes zoom so the original display area (game.project width/height) fits inside the window
16
+ * while preserving aspect ratio. Equivalent to using min(window_width/width, window_height/height).
17
+ */
18
+ const ORTHO_MODE_AUTO_FIT: number & { readonly __brand: "camera.ORTHO_MODE_AUTO_FIT" };
19
+ /**
20
+ * Uses the manually set orthographic zoom value (camera.set_orthographic_zoom).
21
+ */
22
+ const ORTHO_MODE_FIXED: number & { readonly __brand: "camera.ORTHO_MODE_FIXED" };
23
+ /**
24
+ * Gets the effective aspect ratio of the camera. If auto aspect ratio is enabled,
25
+ * returns the aspect ratio calculated from the current render target dimensions.
26
+ * Otherwise returns the manually set aspect ratio.
27
+ *
28
+ * @param camera - camera id
29
+ * @returns the effective aspect ratio.
30
+ */
31
+ function get_aspect_ratio(camera?: Url | number): number;
32
+ /**
33
+ * Returns whether auto aspect ratio is enabled. When enabled, the camera automatically
34
+ * calculates aspect ratio from render target dimensions. When disabled, uses the
35
+ * manually set aspect ratio value.
36
+ *
37
+ * @param camera - camera id
38
+ * @returns true if auto aspect ratio is enabled
39
+ */
40
+ function get_auto_aspect_ratio(camera?: Url | number): boolean;
41
+ /**
42
+ * This function returns a table with all the camera URLs that have been
43
+ * registered in the render context.
44
+ *
45
+ * @returns a table with all camera URLs
46
+ * @example
47
+ * ```ts
48
+ * for (const camera_id of camera.get_cameras()) {
49
+ * render.set_camera(camera_id);
50
+ * render.draw(predicate);
51
+ * render.set_camera();
52
+ * }
53
+ * ```
54
+ */
55
+ function get_cameras(): Url[];
56
+ /**
57
+ * get enabled
58
+ *
59
+ * @param camera - camera id
60
+ * @returns true if the camera is enabled
61
+ */
62
+ function get_enabled(camera?: Url | number): boolean;
63
+ /**
64
+ * get far z
65
+ *
66
+ * @param camera - camera id
67
+ * @returns the far z.
68
+ */
69
+ function get_far_z(camera?: Url | number): number;
70
+ /**
71
+ * get field of view
72
+ *
73
+ * @param camera - camera id
74
+ * @returns the field of view.
75
+ */
76
+ function get_fov(camera?: Url | number): number;
77
+ /**
78
+ * get near z
79
+ *
80
+ * @param camera - camera id
81
+ * @returns the near z.
82
+ */
83
+ function get_near_z(camera?: Url | number): number;
84
+ /**
85
+ * get orthographic zoom mode
86
+ *
87
+ * @param camera - camera id
88
+ * @returns one of camera.ORTHO_MODE_FIXED, camera.ORTHO_MODE_AUTO_FIT or
89
+ * camera.ORTHO_MODE_AUTO_COVER
90
+ */
91
+ function get_orthographic_mode(camera?: Url | number): number;
92
+ /**
93
+ * get orthographic zoom
94
+ *
95
+ * @param camera - camera id
96
+ * @returns the zoom level when the camera uses orthographic projection.
97
+ */
98
+ function get_orthographic_zoom(camera?: Url | number): number;
99
+ /**
100
+ * get projection matrix
101
+ *
102
+ * @param camera - camera id
103
+ * @returns the projection matrix.
104
+ */
105
+ function get_projection(camera?: Url | number): Matrix4;
106
+ /**
107
+ * get view matrix
108
+ *
109
+ * @param camera - camera id
110
+ * @returns the view matrix.
111
+ */
112
+ function get_view(camera?: Url | number): Matrix4;
113
+ /**
114
+ * Converts a screen-space 2D point with view depth to a 3D world point.
115
+ * z is the view depth in world units measured from the camera plane along the camera forward axis.
116
+ * If a camera isn't specified, the last enabled camera is used.
117
+ *
118
+ * @param pos - Screen-space position (x, y) with z as view depth in world units
119
+ * @param camera - optional camera id
120
+ * @returns the world coordinate
121
+ * @example
122
+ * ```ts
123
+ * // Place objects at the touch point with a random Z position, keeping them
124
+ * // within the visible view zone.
125
+ * export default defineScript({
126
+ * on_input(self, action_id, action) {
127
+ * if (action_id === hash("touch")) {
128
+ * if (action.pressed) {
129
+ * const perspective_camera = msg.url("#perspective_camera");
130
+ * const random_z = math.random(
131
+ * camera.get_near_z(perspective_camera) + 0.01,
132
+ * camera.get_far_z(perspective_camera) - 0.01,
133
+ * );
134
+ * const world_position = camera.screen_to_world(
135
+ * vmath.vector3(action.screen_x, action.screen_y, random_z),
136
+ * perspective_camera,
137
+ * );
138
+ * go.set_position(world_position, "/go1");
139
+ * }
140
+ * }
141
+ * },
142
+ * });
143
+ * ```
144
+ */
145
+ function screen_to_world(pos: Vector3, camera?: Url | number): Vector3;
146
+ /**
147
+ * Converts 2D screen coordinates (x,y) to the 3D world-space point on the camera's near plane for that pixel.
148
+ * If a camera isn't specified, the last enabled camera is used.
149
+ *
150
+ * @param x - X coordinate on screen.
151
+ * @param y - Y coordinate on screen.
152
+ * @param camera - optional camera id
153
+ * @returns the world coordinate on the camera near plane
154
+ * @example
155
+ * ```ts
156
+ * // Place objects at the touch point.
157
+ * export default defineScript({
158
+ * on_input(self, action_id, action) {
159
+ * if (action_id === hash("touch")) {
160
+ * if (action.pressed) {
161
+ * const world_position = camera.screen_xy_to_world(action.screen_x, action.screen_y);
162
+ * go.set_position(world_position, "/go1");
163
+ * }
164
+ * }
165
+ * },
166
+ * });
167
+ * ```
168
+ */
169
+ function screen_xy_to_world(x: number, y: number, camera?: Url | number): Vector3;
170
+ /**
171
+ * Sets the manual aspect ratio for the camera. This value is only used when
172
+ * auto aspect ratio is disabled. To disable auto aspect ratio and use this
173
+ * manual value, call camera.set_auto_aspect_ratio(camera, false).
174
+ *
175
+ * @param camera - camera id
176
+ * @param aspect_ratio - the manual aspect ratio value.
177
+ */
178
+ function set_aspect_ratio(camera: Url | number | undefined, aspect_ratio: number): void;
179
+ /**
180
+ * Enables or disables automatic aspect ratio calculation. When enabled (true),
181
+ * the camera automatically calculates aspect ratio from render target dimensions.
182
+ * When disabled (false), uses the manually set aspect ratio value.
183
+ *
184
+ * @param camera - camera id
185
+ * @param auto_aspect_ratio - true to enable auto aspect ratio
186
+ */
187
+ function set_auto_aspect_ratio(camera: Url | number | undefined, auto_aspect_ratio: boolean): void;
188
+ /**
189
+ * set far z
190
+ *
191
+ * @param camera - camera id
192
+ * @param far_z - the far z.
193
+ */
194
+ function set_far_z(camera: Url | number | undefined, far_z: number): void;
195
+ /**
196
+ * set field of view
197
+ *
198
+ * @param camera - camera id
199
+ * @param fov - the field of view.
200
+ */
201
+ function set_fov(camera: Url | number | undefined, fov: number): void;
202
+ /**
203
+ * set near z
204
+ *
205
+ * @param camera - camera id
206
+ * @param near_z - the near z.
207
+ */
208
+ function set_near_z(camera: Url | number | undefined, near_z: number): void;
209
+ /**
210
+ * set orthographic zoom mode
211
+ *
212
+ * @param camera - camera id
213
+ * @param mode - camera.ORTHO_MODE_FIXED, camera.ORTHO_MODE_AUTO_FIT or camera.ORTHO_MODE_AUTO_COVER
214
+ */
215
+ function set_orthographic_mode(camera: Url | number | undefined, mode: number): void;
216
+ /**
217
+ * set orthographic zoom
218
+ *
219
+ * @param camera - camera id
220
+ * @param orthographic_zoom - the zoom level when the camera uses orthographic projection.
221
+ */
222
+ function set_orthographic_zoom(camera: Url | number | undefined, orthographic_zoom: number): void;
223
+ /**
224
+ * Converts a 3D world position to screen-space coordinates with view depth.
225
+ * Returns a vector3 where x and y are in screen pixels and z is the view depth in world units
226
+ * measured from the camera plane along the camera forward axis. The returned z can be used with
227
+ * camera.screen_to_world to reconstruct the world position on the same pixel ray.
228
+ * If a camera isn't specified, the last enabled camera is used.
229
+ *
230
+ * @param world_pos - World-space position
231
+ * @param camera - optional camera id
232
+ * @returns Screen position (x,y in pixels, z is view depth)
233
+ * @example
234
+ * ```ts
235
+ * // Convert a game object position into a screen position.
236
+ * go.update_world_transform("/go1");
237
+ * const world_pos = go.get_world_position("/go1");
238
+ * const screen_pos = camera.world_to_screen(world_pos);
239
+ * ```
240
+ */
241
+ function world_to_screen(world_pos: Vector3, camera?: Url | number): Vector3;
242
+ }
243
+ }
244
+
245
+ export {};
@@ -0,0 +1,146 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Opaque, Quaternion, Url, Vector3 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for controlling collection factory components which are
7
+ * used to dynamically spawn collections into the runtime.
8
+ */
9
+ namespace collectionfactory {
10
+ /**
11
+ * loaded
12
+ */
13
+ const STATUS_LOADED: number & { readonly __brand: "collectionfactory.STATUS_LOADED" };
14
+ /**
15
+ * loading
16
+ */
17
+ const STATUS_LOADING: number & { readonly __brand: "collectionfactory.STATUS_LOADING" };
18
+ /**
19
+ * unloaded
20
+ */
21
+ const STATUS_UNLOADED: number & { readonly __brand: "collectionfactory.STATUS_UNLOADED" };
22
+ /**
23
+ * The URL identifies the collectionfactory component that should do the spawning.
24
+ * Spawning is instant, but spawned game objects get their first update calls the following frame. The supplied parameters for position, rotation and scale
25
+ * will be applied to the whole collection when spawned.
26
+ * Script properties in the created game objects can be overridden through
27
+ * a properties-parameter table. The table should contain game object ids
28
+ * (hash) as keys and property tables as values to be used when initiating each
29
+ * spawned game object.
30
+ * See go.property for more information on script properties.
31
+ * The function returns a table that contains a key for each game object
32
+ * id (hash), as addressed if the collection file was top level, and the
33
+ * corresponding spawned instance id (hash) as value with a unique path
34
+ * prefix added to each instance.
35
+ * Calling collectionfactory.create create on a collection factory that is marked as dynamic without having loaded resources
36
+ * using collectionfactory.load will synchronously load and create resources which may affect application performance.
37
+ *
38
+ * @param url - the collection factory component to be used
39
+ * @param position - position to assign to the newly spawned collection
40
+ * @param rotation - rotation to assign to the newly spawned collection
41
+ * @param properties - table of script properties to propagate to any new game object instances
42
+ * @param scale - uniform scaling to apply to the newly spawned collection (must be greater than 0).
43
+ * @returns a table mapping the id:s from the collection to the new instance id:s
44
+ * @example
45
+ * ```ts
46
+ * // How to spawn a collection of game objects:
47
+ * export default defineScript({
48
+ * init(self) {
49
+ * // Spawn a small group of enemies.
50
+ * const pos = vmath.vector3(100, 12.5, 0);
51
+ * const rot = vmath.quat_rotation_z(Math.PI / 2);
52
+ * const scale = 0.5;
53
+ * const props = {
54
+ * [hash("/enemy_leader")]: { health: 1000.0 },
55
+ * [hash("/enemy_1")]: { health: 200.0 },
56
+ * [hash("/enemy_2")]: { health: 400.0, color: hash("green") },
57
+ * };
58
+ *
59
+ * self.enemy_ids = collectionfactory.create("#enemyfactory", pos, rot, props, scale);
60
+ * // enemy_ids now map to the spawned instance ids:
61
+ * //
62
+ * // pprint(self.enemy_ids)
63
+ * //
64
+ * // DEBUG:SCRIPT:
65
+ * // {
66
+ * // hash: [/enemy_leader] = hash: [/collection0/enemy_leader],
67
+ * // hash: [/enemy_1] = hash: [/collection0/enemy_1],
68
+ * // hash: [/enemy_2] = hash: [/collection0/enemy_2]
69
+ * // }
70
+ *
71
+ * // Send "attack" message to the leader. First look up its instance id.
72
+ * const leader_id = self.enemy_ids[hash("/enemy_leader")];
73
+ * msg.post(leader_id, "attack");
74
+ * },
75
+ * });
76
+ *
77
+ * // How to delete a spawned collection:
78
+ * go.delete(self.enemy_ids);
79
+ * ```
80
+ */
81
+ function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: Record<string | number, unknown>, scale?: number | Vector3): LuaMap<Hash, Hash>;
82
+ /**
83
+ * This returns status of the collection factory.
84
+ * Calling this function when the factory is not marked as dynamic loading always returns COMP_COLLECTION_FACTORY_STATUS_LOADED.
85
+ *
86
+ * @param url - the collection factory component to get status from
87
+ * @returns status of the collection factory component
88
+ *
89
+ * - `collectionfactory.STATUS_UNLOADED`
90
+ *
91
+ * - `collectionfactory.STATUS_LOADING`
92
+ *
93
+ * - `collectionfactory.STATUS_LOADED`
94
+ */
95
+ function get_status(url?: string | Hash | Url): Opaque<"constant">;
96
+ /**
97
+ * Resources loaded are referenced by the collection factory component until the existing (parent) collection is destroyed or collectionfactory.unload is called.
98
+ * Calling this function when the factory is not marked as dynamic loading does nothing.
99
+ *
100
+ * @param url - the collection factory component to load
101
+ * @param complete_function - function to call when resources are loaded.
102
+ *
103
+ * `self`
104
+ * object The current object.
105
+ * `url`
106
+ * url url of the collection factory component
107
+ * `result`
108
+ * boolean True if resource were loaded successfully
109
+ * @example
110
+ * ```ts
111
+ * // How to load resources of a collection factory prototype.
112
+ * collectionfactory.load("#factory", (self, url, result) => {});
113
+ * ```
114
+ */
115
+ function load(url?: string | Hash | Url, complete_function?: (self: unknown, url: unknown, result: unknown) => void): void;
116
+ /**
117
+ * Changes the prototype for the collection factory.
118
+ * Setting the prototype to "nil" will revert back to the original prototype.
119
+ *
120
+ * @param url - the collection factory component
121
+ * @param prototype - the path to the new prototype, or `nil`
122
+ * @example
123
+ * ```ts
124
+ * // How to unload the previous prototype's resources, and then spawn a new collection:
125
+ * collectionfactory.unload("#factory"); // unload the previous resources
126
+ * collectionfactory.set_prototype("#factory", "/main/levels/level1.collectionc");
127
+ * const ids = collectionfactory.create("#factory", go.get_world_position(), vmath.quat());
128
+ * ```
129
+ */
130
+ function set_prototype(url?: string | Hash | Url, prototype?: string): void;
131
+ /**
132
+ * This decreases the reference count for each resource loaded with collectionfactory.load. If reference is zero, the resource is destroyed.
133
+ * Calling this function when the factory is not marked as dynamic loading does nothing.
134
+ *
135
+ * @param url - the collection factory component to unload
136
+ * @example
137
+ * ```ts
138
+ * // How to unload resources of a collection factory prototype loaded with collectionfactory.load:
139
+ * collectionfactory.unload("#factory");
140
+ * ```
141
+ */
142
+ function unload(url?: string | Hash | Url): void;
143
+ }
144
+ }
145
+
146
+ export {};
@@ -0,0 +1,71 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Url } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Messages for controlling and interacting with collection proxies
7
+ * which are used to dynamically load collections into the runtime.
8
+ */
9
+ namespace collectionproxy {
10
+ /**
11
+ * It's impossible to change the collection if the collection is already loaded.
12
+ */
13
+ const RESULT_ALREADY_LOADED: number & { readonly __brand: "collectionproxy.RESULT_ALREADY_LOADED" };
14
+ /**
15
+ * It's impossible to change the collection while the collection proxy is loading.
16
+ */
17
+ const RESULT_LOADING: number & { readonly __brand: "collectionproxy.RESULT_LOADING" };
18
+ /**
19
+ * It's impossible to change the collection for a proxy that isn't excluded.
20
+ */
21
+ const RESULT_NOT_EXCLUDED: number & { readonly __brand: "collectionproxy.RESULT_NOT_EXCLUDED" };
22
+ /**
23
+ * return an indexed table of resources for a collection proxy where the
24
+ * referenced collection has been excluded using LiveUpdate. Each entry is a
25
+ * hexadecimal string that represents the data of the specific resource.
26
+ * This representation corresponds with the filename for each individual
27
+ * resource that is exported when you bundle an application with LiveUpdate
28
+ * functionality.
29
+ *
30
+ * @param collectionproxy - the collectionproxy to check for resources.
31
+ * @returns the resources, or an empty list if the
32
+ * collection was not excluded.
33
+ * @example
34
+ * ```ts
35
+ * function print_resources(self, cproxy) {
36
+ * const resources = collectionproxy.get_resources(cproxy);
37
+ * for (const v of resources) {
38
+ * print(`Resource: ${v}`);
39
+ * }
40
+ * }
41
+ * ```
42
+ */
43
+ function get_resources(collectionproxy: Url): Hash[];
44
+ /**
45
+ * The collection should be loaded by the collection proxy.
46
+ * Setting the collection to "nil" will revert it back to the original collection.
47
+ * The collection proxy shouldn't be loaded and should have the 'Exclude' checkbox checked.
48
+ * This functionality is designed to simplify the management of Live Update resources.
49
+ *
50
+ * @param url - the collection proxy component
51
+ * @param prototype - the path to the new collection, or `nil`
52
+ * @example
53
+ * ```ts
54
+ * // The example assumes the script belongs to an instance with a
55
+ * // collection-proxy-component with id "proxy".
56
+ * const [ok, error] = collectionproxy.set_collection("/go#collectionproxy", "/LU/3.collectionc");
57
+ * if (ok) {
58
+ * print("The collection has been changed to /LU/3.collectionc");
59
+ * } else {
60
+ * print("Error changing collection to /LU/3.collectionc ", error);
61
+ * }
62
+ * msg.post("/go#collectionproxy", "load");
63
+ * msg.post("/go#collectionproxy", "init");
64
+ * msg.post("/go#collectionproxy", "enable");
65
+ * ```
66
+ */
67
+ function set_collection(url?: string | Hash | Url, prototype?: string): LuaMultiReturn<[boolean, number]>;
68
+ }
69
+ }
70
+
71
+ export {};
@@ -0,0 +1,143 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Native crash logging functions and constants.
5
+ */
6
+ namespace crash {
7
+ /**
8
+ * android build fingerprint
9
+ */
10
+ const SYSFIELD_ANDROID_BUILD_FINGERPRINT: number & { readonly __brand: "crash.SYSFIELD_ANDROID_BUILD_FINGERPRINT" };
11
+ /**
12
+ * system device language as reported by sys.get_sys_info
13
+ */
14
+ const SYSFIELD_DEVICE_LANGUAGE: number & { readonly __brand: "crash.SYSFIELD_DEVICE_LANGUAGE" };
15
+ /**
16
+ * device model as reported by sys.get_sys_info
17
+ */
18
+ const SYSFIELD_DEVICE_MODEL: number & { readonly __brand: "crash.SYSFIELD_DEVICE_MODEL" };
19
+ /**
20
+ * engine version as hash
21
+ */
22
+ const SYSFIELD_ENGINE_HASH: number & { readonly __brand: "crash.SYSFIELD_ENGINE_HASH" };
23
+ /**
24
+ * engine version as release number
25
+ */
26
+ const SYSFIELD_ENGINE_VERSION: number & { readonly __brand: "crash.SYSFIELD_ENGINE_VERSION" };
27
+ /**
28
+ * system language as reported by sys.get_sys_info
29
+ */
30
+ const SYSFIELD_LANGUAGE: number & { readonly __brand: "crash.SYSFIELD_LANGUAGE" };
31
+ /**
32
+ * device manufacturer as reported by sys.get_sys_info
33
+ */
34
+ const SYSFIELD_MANUFACTURER: number & { readonly __brand: "crash.SYSFIELD_MANUFACTURER" };
35
+ /**
36
+ * The max number of sysfields.
37
+ */
38
+ const SYSFIELD_MAX: number & { readonly __brand: "crash.SYSFIELD_MAX" };
39
+ /**
40
+ * system name as reported by sys.get_sys_info
41
+ */
42
+ const SYSFIELD_SYSTEM_NAME: number & { readonly __brand: "crash.SYSFIELD_SYSTEM_NAME" };
43
+ /**
44
+ * system version as reported by sys.get_sys_info
45
+ */
46
+ const SYSFIELD_SYSTEM_VERSION: number & { readonly __brand: "crash.SYSFIELD_SYSTEM_VERSION" };
47
+ /**
48
+ * system territory as reported by sys.get_sys_info
49
+ */
50
+ const SYSFIELD_TERRITORY: number & { readonly __brand: "crash.SYSFIELD_TERRITORY" };
51
+ /**
52
+ * The max number of user fields.
53
+ */
54
+ const USERFIELD_MAX: number & { readonly __brand: "crash.USERFIELD_MAX" };
55
+ /**
56
+ * The max size of a single user field.
57
+ */
58
+ const USERFIELD_SIZE: number & { readonly __brand: "crash.USERFIELD_SIZE" };
59
+ /**
60
+ * A table is returned containing the addresses of the call stack.
61
+ *
62
+ * @param handle - crash dump handle
63
+ * @returns table containing the backtrace
64
+ */
65
+ function get_backtrace(handle: number): Record<string | number, unknown>;
66
+ /**
67
+ * The format of read text blob is platform specific
68
+ * and not guaranteed
69
+ * but can be useful for manual inspection.
70
+ *
71
+ * @param handle - crash dump handle
72
+ * @returns string with the platform specific data
73
+ */
74
+ function get_extra_data(handle: number): string;
75
+ /**
76
+ * The function returns a table containing entries with sub-tables that
77
+ * have fields 'name' and 'address' set for all loaded modules.
78
+ *
79
+ * @param handle - crash dump handle
80
+ * @returns module table
81
+ */
82
+ function get_modules(handle: number): Record<string | number, unknown>;
83
+ /**
84
+ * read signal number from a crash report
85
+ *
86
+ * @param handle - crash dump handle
87
+ * @returns signal number
88
+ */
89
+ function get_signum(handle: number): number;
90
+ /**
91
+ * reads a system field from a loaded crash dump
92
+ *
93
+ * @param handle - crash dump handle
94
+ * @param index - system field enum. Must be less than crash.SYSFIELD_MAX
95
+ * @returns value recorded in the crash dump, or `nil` if it didn't exist
96
+ */
97
+ function get_sys_field(handle: number, index: number): string | unknown;
98
+ /**
99
+ * reads user field from a loaded crash dump
100
+ *
101
+ * @param handle - crash dump handle
102
+ * @param index - user data slot index
103
+ * @returns user data value recorded in the crash dump
104
+ */
105
+ function get_user_field(handle: number, index: number): string;
106
+ /**
107
+ * The crash dump will be removed from disk upon a successful
108
+ * load, so loading is one-shot.
109
+ *
110
+ * @returns handle to the loaded dump, or `nil` if no dump was found
111
+ */
112
+ function load_previous(): number | unknown;
113
+ /**
114
+ * releases a previously loaded crash dump
115
+ *
116
+ * @param handle - handle to loaded crash dump
117
+ */
118
+ function release(handle: number): void;
119
+ /**
120
+ * Crashes occuring before the path is set will be stored to a default engine location.
121
+ *
122
+ * @param path - file path to use
123
+ */
124
+ function set_file_path(path: string): void;
125
+ /**
126
+ * Store a user value that will get written to a crash dump when
127
+ * a crash occurs. This can be user id:s, breadcrumb data etc.
128
+ * There are 32 slots indexed from 0. Each slot stores at most 255 characters.
129
+ *
130
+ * @param index - slot index. 0-indexed
131
+ * @param value - string value to store
132
+ */
133
+ function set_user_field(index: number, value: string): void;
134
+ /**
135
+ * Performs the same steps as if a crash had just occured but
136
+ * allows the program to continue.
137
+ * The generated dump can be read by crash.load_previous
138
+ */
139
+ function write_dump(): void;
140
+ }
141
+ }
142
+
143
+ export {};