@defold-typescript/types 0.25.0 → 0.27.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 (80) hide show
  1. package/api-availability.json +333 -306
  2. package/api-signatures.json +1312 -0
  3. package/api-targets.json +351 -2
  4. package/examples/translations.json +1984 -0
  5. package/fixtures/messages_doc.json +880 -0
  6. package/generated/collectionproxy.d.ts +22 -0
  7. package/generated/editor-vm/http.d.ts +2 -2
  8. package/generated/editor-vm/image.d.ts +48 -0
  9. package/generated/editor.d.ts +27 -8
  10. package/generated/gui.d.ts +35 -6
  11. package/generated/kinds/editor-script.d.ts +1 -0
  12. package/generated/material.d.ts +4 -0
  13. package/generated/versions/defold-1.12.4/liveupdate.d.ts +22 -22
  14. package/generated/versions/defold-1.12.4/physics.d.ts +78 -75
  15. package/generated/versions/defold-1.12.4/render.d.ts +75 -55
  16. package/generated/versions/defold-1.12.4/resource.d.ts +187 -175
  17. package/generated/versions/defold-1.13.0/b2d.d.ts +33 -0
  18. package/generated/versions/defold-1.13.0/b2d_body.d.ts +676 -0
  19. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +106 -0
  20. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +155 -0
  21. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +823 -0
  22. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +215 -0
  23. package/generated/versions/defold-1.13.0/b2d_world.d.ts +314 -0
  24. package/generated/versions/defold-1.13.0/buffer.d.ts +176 -0
  25. package/generated/versions/defold-1.13.0/camera.d.ts +302 -0
  26. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +146 -0
  27. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +71 -0
  28. package/generated/versions/defold-1.13.0/compute.d.ts +306 -0
  29. package/generated/versions/defold-1.13.0/crash.d.ts +143 -0
  30. package/generated/versions/defold-1.13.0/editor-vm/http.d.ts +56 -0
  31. package/generated/versions/defold-1.13.0/editor-vm/json.d.ts +10 -0
  32. package/generated/versions/defold-1.13.0/editor-vm/localization.d.ts +42 -0
  33. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +80 -0
  34. package/generated/versions/defold-1.13.0/editor-vm/zip.d.ts +10 -0
  35. package/generated/versions/defold-1.13.0/editor-vm/zlib.d.ts +24 -0
  36. package/generated/versions/defold-1.13.0/editor.d.ts +1092 -0
  37. package/generated/versions/defold-1.13.0/factory.d.ts +123 -0
  38. package/generated/versions/defold-1.13.0/font.d.ts +81 -0
  39. package/generated/versions/defold-1.13.0/go.d.ts +1054 -0
  40. package/generated/versions/defold-1.13.0/graphics.d.ts +321 -0
  41. package/generated/versions/defold-1.13.0/gui.d.ts +2370 -0
  42. package/generated/versions/defold-1.13.0/html5.d.ts +53 -0
  43. package/generated/versions/defold-1.13.0/http.d.ts +84 -0
  44. package/generated/versions/defold-1.13.0/iac.d.ts +18 -0
  45. package/generated/versions/defold-1.13.0/iap.d.ts +60 -0
  46. package/generated/versions/defold-1.13.0/image.d.ts +139 -0
  47. package/generated/versions/defold-1.13.0/index.d.ts +48 -0
  48. package/generated/versions/defold-1.13.0/json.d.ts +76 -0
  49. package/generated/versions/defold-1.13.0/kinds/editor-script.d.ts +13 -0
  50. package/generated/versions/defold-1.13.0/label.d.ts +94 -0
  51. package/generated/versions/defold-1.13.0/liveupdate.d.ts +140 -0
  52. package/generated/versions/defold-1.13.0/material.d.ts +444 -0
  53. package/generated/versions/defold-1.13.0/model.d.ts +246 -0
  54. package/generated/versions/defold-1.13.0/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.0/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.13.0/physics.d.ts +548 -0
  57. package/generated/versions/defold-1.13.0/profiler.d.ts +233 -0
  58. package/generated/versions/defold-1.13.0/push.d.ts +66 -0
  59. package/generated/versions/defold-1.13.0/render.d.ts +1185 -0
  60. package/generated/versions/defold-1.13.0/resource.d.ts +1530 -0
  61. package/generated/versions/defold-1.13.0/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.13.0/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.13.0/sprite.d.ts +157 -0
  64. package/generated/versions/defold-1.13.0/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.13.0/tilemap.d.ts +195 -0
  66. package/generated/versions/defold-1.13.0/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.13.0/types.d.ts +61 -0
  68. package/generated/versions/defold-1.13.0/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.13.0/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.13.0/window.d.ts +198 -0
  71. package/generated/versions/defold-1.13.0/zlib.d.ts +40 -0
  72. package/index.d.ts +4 -81
  73. package/package.json +11 -3
  74. package/scripts/import-defold-release.ts +28 -1
  75. package/scripts/sync-api-docs.ts +4 -3
  76. package/src/api-availability.ts +0 -0
  77. package/src/emit-dts.ts +6 -0
  78. package/src/example-store.ts +5 -0
  79. package/src/index.ts +3 -0
  80. package/scripts/lua-types-signature-index.ts +0 -151
@@ -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,306 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Matrix4, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for interacting with compute programs.
7
+ */
8
+ namespace compute {
9
+ /**
10
+ * Returns a table of all the shader constants in the compute program.
11
+ *
12
+ * @param path - The path to the resource
13
+ * @returns A table of tables, where each entry contains info about the shader constants:
14
+ *
15
+ * `name`
16
+ * hash the hashed name of the constant
17
+ * `type`
18
+ * number the type of the constant. Supported values:
19
+ *
20
+ * - `material.CONSTANT_TYPE_USER`
21
+ *
22
+ * - `material.CONSTANT_TYPE_USER_MATRIX4`
23
+ *
24
+ * - `material.CONSTANT_TYPE_VIEWPROJ`
25
+ *
26
+ * - `material.CONSTANT_TYPE_WORLD`
27
+ *
28
+ * - `material.CONSTANT_TYPE_TEXTURE`
29
+ *
30
+ * - `material.CONSTANT_TYPE_VIEW`
31
+ *
32
+ * - `material.CONSTANT_TYPE_PROJECTION`
33
+ *
34
+ * - `material.CONSTANT_TYPE_NORMAL`
35
+ *
36
+ * - `material.CONSTANT_TYPE_WORLDVIEW`
37
+ *
38
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
39
+ *
40
+ * - `material.CONSTANT_TYPE_TIME`
41
+ *
42
+ * - `material.CONSTANT_TYPE_WORLD_INVERSE`
43
+ *
44
+ * - `material.CONSTANT_TYPE_VIEW_INVERSE`
45
+ *
46
+ * - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
47
+ *
48
+ * - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
49
+ *
50
+ * - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
51
+ *
52
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
53
+ *
54
+ * `value`
55
+ * vmath.vector4 | vmath.matrix4 the value(s) of the constant. If the constant is an array, the value will be a table of vmath.vector4 or vmath.matrix4 if the type is `material.CONSTANT_TYPE_USER_MATRIX4`.
56
+ * @example
57
+ * ```ts
58
+ * const constants = compute.get_constants("/my_compute.computec");
59
+ * ```
60
+ */
61
+ function get_constants(path: Hash | string): { name: Hash; type: number; value: Vector4 | Matrix4 }[];
62
+ /**
63
+ * Returns a table of all the texture samplers in the compute program. This function will return all the texture samplers
64
+ * that are available, even the ones that have not been specified in the compute resource.
65
+ *
66
+ * @param path - The path to the resource
67
+ * @returns A table of tables, where each entry contains info about the texture samplers:
68
+ *
69
+ * `name`
70
+ * hash the hashed name of the texture sampler
71
+ * `u_wrap`
72
+ * number the u wrap mode of the texture sampler. Supported values:
73
+ *
74
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
75
+ *
76
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
77
+ *
78
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
79
+ *
80
+ * - `graphics.TEXTURE_WRAP_REPEAT`
81
+ *
82
+ * `v_wrap`
83
+ * number the v wrap mode of the texture sampler. Supported values:
84
+ *
85
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
86
+ *
87
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
88
+ *
89
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
90
+ *
91
+ * - `graphics.TEXTURE_WRAP_REPEAT`
92
+ *
93
+ * `min_filter`
94
+ * number the min filter mode of the texture sampler. Supported values:
95
+ *
96
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
97
+ *
98
+ * - `graphics.TEXTURE_FILTER_NEAREST`
99
+ *
100
+ * - `graphics.TEXTURE_FILTER_LINEAR`
101
+ *
102
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
103
+ *
104
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
105
+ *
106
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
107
+ *
108
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
109
+ *
110
+ * `mag_filter`
111
+ * number the mag filter mode of the texture sampler
112
+ *
113
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
114
+ *
115
+ * - `graphics.TEXTURE_FILTER_NEAREST`
116
+ *
117
+ * - `graphics.TEXTURE_FILTER_LINEAR`
118
+ *
119
+ * `max_anisotropy`
120
+ * number the max anisotropy of the texture sampler
121
+ * @example
122
+ * ```ts
123
+ * const samplers = compute.get_samplers("/my_compute.computec");
124
+ * ```
125
+ */
126
+ function get_samplers(path: Hash | string): { name: Hash; u_wrap: number; v_wrap: number; min_filter: number; mag_filter: number; max_anisotropy: number }[];
127
+ /**
128
+ * Returns a table of all the textures from the compute program.
129
+ *
130
+ * @param path - The path to the resource
131
+ * @returns A table of tables, where each entry contains info about the compute textures:
132
+ *
133
+ * `path`
134
+ * hash the resource path of the texture. Only available if the texture is a resource.
135
+ * `handle`
136
+ * hash the runtime handle of the texture.
137
+ * `width`
138
+ * number the width of the texture
139
+ * `height`
140
+ * number the height of the texture
141
+ * `depth`
142
+ * number the depth of the texture. Corresponds to the number of layers in an array texture.
143
+ * `mipmaps`
144
+ * number the number of mipmaps in the texture
145
+ * `type`
146
+ * number the type of the texture. Supported values:
147
+ *
148
+ * - `graphics.TEXTURE_TYPE_2D`
149
+ *
150
+ * - `graphics.TEXTURE_TYPE_2D_ARRAY`
151
+ *
152
+ * - `graphics.TEXTURE_TYPE_CUBE_MAP`
153
+ *
154
+ * - `graphics.TEXTURE_TYPE_IMAGE_2D`
155
+ *
156
+ * - `graphics.TEXTURE_TYPE_3D`
157
+ *
158
+ * - `graphics.TEXTURE_TYPE_IMAGE_3D`
159
+ *
160
+ * `flags`
161
+ * number the flags of the texture. This field is a bit mask of these supported flags:
162
+ *
163
+ * - `graphics.TEXTURE_USAGE_FLAG_SAMPLE`
164
+ *
165
+ * - `graphics.TEXTURE_USAGE_FLAG_MEMORYLESS`
166
+ *
167
+ * - `graphics.TEXTURE_USAGE_FLAG_STORAGE`
168
+ *
169
+ * - `graphics.TEXTURE_USAGE_FLAG_INPUT`
170
+ *
171
+ * - `graphics.TEXTURE_USAGE_FLAG_COLOR`
172
+ * @example
173
+ * ```ts
174
+ * const textures = compute.get_textures("/my_compute.computec");
175
+ * ```
176
+ */
177
+ function get_textures(path: Hash | string): { path: Hash; handle: Hash; width: number; height: number; depth: number; mipmaps: number; type: number; flags: number }[];
178
+ /**
179
+ * Sets shader constants in a compute program, if the constants exist.
180
+ *
181
+ * @param path - The path to the resource
182
+ * @param constants - A table keyed by constant name with args tables as values. Constants can be partially updated. Supported entries:
183
+ *
184
+ * `type`
185
+ * number the type of the constant. Supported values:
186
+ *
187
+ * - `material.CONSTANT_TYPE_USER`
188
+ *
189
+ * - `material.CONSTANT_TYPE_USER_MATRIX4`
190
+ *
191
+ * - `material.CONSTANT_TYPE_VIEWPROJ`
192
+ *
193
+ * - `material.CONSTANT_TYPE_WORLD`
194
+ *
195
+ * - `material.CONSTANT_TYPE_TEXTURE`
196
+ *
197
+ * - `material.CONSTANT_TYPE_VIEW`
198
+ *
199
+ * - `material.CONSTANT_TYPE_PROJECTION`
200
+ *
201
+ * - `material.CONSTANT_TYPE_NORMAL`
202
+ *
203
+ * - `material.CONSTANT_TYPE_WORLDVIEW`
204
+ *
205
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ`
206
+ *
207
+ * - `material.CONSTANT_TYPE_TIME`
208
+ *
209
+ * - `material.CONSTANT_TYPE_WORLD_INVERSE`
210
+ *
211
+ * - `material.CONSTANT_TYPE_VIEW_INVERSE`
212
+ *
213
+ * - `material.CONSTANT_TYPE_PROJECTION_INVERSE`
214
+ *
215
+ * - `material.CONSTANT_TYPE_VIEWPROJ_INVERSE`
216
+ *
217
+ * - `material.CONSTANT_TYPE_WORLDVIEW_INVERSE`
218
+ *
219
+ * - `material.CONSTANT_TYPE_WORLDVIEWPROJ_INVERSE`
220
+ *
221
+ * `value`
222
+ * 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.
223
+ * @example
224
+ * ```ts
225
+ * compute.set_constants("/my_compute.computec", { tint: { value: vmath.vector4(1, 0, 0, 1) } });
226
+ * ```
227
+ */
228
+ function set_constants(path: Hash | string, constants: Record<string, { type?: number; value?: Vector4 | Vector3 | Matrix4 | number | (Vector4 | Matrix4)[] }>): void;
229
+ /**
230
+ * Sets texture samplers in a compute program, if the samplers exist. Use this function to change the settings of texture samplers.
231
+ * To set actual textures that should be bound to the samplers, use the `compute.set_textures` function instead.
232
+ *
233
+ * @param path - The path to the resource
234
+ * @param samplers - A table keyed by sampler name with args tables as values. Partial updates are supported. Supported entries:
235
+ *
236
+ * `u_wrap`
237
+ * number the u wrap mode of the texture sampler. Supported values:
238
+ *
239
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
240
+ *
241
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
242
+ *
243
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
244
+ *
245
+ * - `graphics.TEXTURE_WRAP_REPEAT`
246
+ *
247
+ * `v_wrap`
248
+ * number the v wrap mode of the texture sampler. Supported values:
249
+ *
250
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_BORDER`
251
+ *
252
+ * - `graphics.TEXTURE_WRAP_CLAMP_TO_EDGE`
253
+ *
254
+ * - `graphics.TEXTURE_WRAP_MIRRORED_REPEAT`
255
+ *
256
+ * - `graphics.TEXTURE_WRAP_REPEAT`
257
+ *
258
+ * `min_filter`
259
+ * number the min filter mode of the texture sampler. Supported values:
260
+ *
261
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
262
+ *
263
+ * - `graphics.TEXTURE_FILTER_NEAREST`
264
+ *
265
+ * - `graphics.TEXTURE_FILTER_LINEAR`
266
+ *
267
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST`
268
+ *
269
+ * - `graphics.TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR`
270
+ *
271
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST`
272
+ *
273
+ * - `graphics.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR`
274
+ *
275
+ * `mag_filter`
276
+ * number the mag filter mode of the texture sampler
277
+ *
278
+ * - `graphics.TEXTURE_FILTER_DEFAULT`
279
+ *
280
+ * - `graphics.TEXTURE_FILTER_NEAREST`
281
+ *
282
+ * - `graphics.TEXTURE_FILTER_LINEAR`
283
+ *
284
+ * `max_anisotropy`
285
+ * number the max anisotropy of the texture sampler
286
+ * @example
287
+ * ```ts
288
+ * compute.set_samplers("/my_compute.computec", { texture_sampler: { u_wrap: graphics.TEXTURE_WRAP_REPEAT, v_wrap: graphics.TEXTURE_WRAP_MIRRORED_REPEAT } });
289
+ * ```
290
+ */
291
+ function set_samplers(path: Hash | string, samplers: Record<string, { u_wrap?: number; v_wrap?: number; min_filter?: number; mag_filter?: number; max_anisotropy?: number }>): void;
292
+ /**
293
+ * Sets textures in a compute program, if the samplers exist.
294
+ *
295
+ * @param path - The path to the resource
296
+ * @param textures - A table keyed by sampler name with texture resources as values.
297
+ * @example
298
+ * ```ts
299
+ * compute.set_textures("/my_compute.computec", { my_texture: resource.texture() });
300
+ * ```
301
+ */
302
+ function set_textures(path: Hash | string, textures: LuaMap<string, Hash>): void;
303
+ }
304
+ }
305
+
306
+ 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 | undefined;
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 | undefined;
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 {};
@@ -0,0 +1,56 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace http {
7
+ /**
8
+ * Perform an HTTP request
9
+ *
10
+ * @param url - request URL
11
+ * @param opts - Additional request options, a table with the following keys:`method string`request method, defaults to `"GET"``headers table`request headers, a table with string keys and values`body string`request body`as string`response body converter, either `"string"` or `"json"`
12
+ * @returns HTTP response, a table with the following keys:`status integer`response code`headers table`response headers, a table where each key is a lower-cased string, and each value is either a string or an array of strings if the header was repeated`body string, any, nil`response body, present only when `as` option was provided, either a string or a parsed json value
13
+ */
14
+ function request(url: string, opts?: Record<string | number, unknown>): Record<string | number, unknown>;
15
+ namespace server {
16
+ /**
17
+ * Create HTTP response that will stream the content of a file defined by the path
18
+ *
19
+ * @param path - External file path, resolved against project root if relative
20
+ * @param status - HTTP status code, an integer, default 200
21
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
22
+ * @returns HTTP response value, userdata
23
+ */
24
+ function external_file_response(path: string, status?: number, headers?: unknown): unknown;
25
+ /**
26
+ * Create HTTP response with a JSON value
27
+ *
28
+ * @param value - Any Lua value that may be represented as JSON
29
+ * @param status - HTTP status code, an integer, default 200
30
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
31
+ * @returns HTTP response value, userdata
32
+ */
33
+ function json_response(value: unknown, status?: number, headers?: unknown): unknown;
34
+ /**
35
+ * Create HTTP response that will stream the content of a resource defined by the resource path
36
+ *
37
+ * @param resource_path - Resource path (starting with `/`)
38
+ * @param status - HTTP status code, an integer, default 200
39
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
40
+ * @returns HTTP response value, userdata
41
+ */
42
+ function resource_response(resource_path: string, status?: number, headers?: unknown): unknown;
43
+ /**
44
+ * Create HTTP response
45
+ *
46
+ * @param status - HTTP status code, an integer, default 200
47
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
48
+ * @param body - HTTP response body
49
+ * @returns HTTP response value, userdata
50
+ */
51
+ function response(status?: number, headers?: unknown, body?: string): unknown;
52
+ }
53
+ }
54
+ }
55
+
56
+ export {};
@@ -0,0 +1,10 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace json {
7
+ }
8
+ }
9
+
10
+ export {};
@@ -0,0 +1,42 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Editor scripting documentation
7
+ */
8
+ namespace localization {
9
+ /**
10
+ * Create a message pattern that renders a list with the "and" conjunction (for example: a, b, and c) once it is stringified
11
+ *
12
+ * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
13
+ * @returns a userdata value that, when stringified with `tostring()`, will produce a localized text according to the currently selected language in the editor
14
+ */
15
+ function and_list(items: unknown[]): Opaque<"message">;
16
+ /**
17
+ * Create a message pattern that concatenates values (similar to `table.concat`) and performs the actual concatenation when stringified
18
+ *
19
+ * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
20
+ * @param separator - optional separator inserted between values; defaults to an empty string
21
+ * @returns a userdata value that, when stringified with `tostring()`, will produce a localized text according to the currently selected language in the editor
22
+ */
23
+ function concat(items: unknown[], separator?: boolean | number | string | Opaque<"message">): Opaque<"message">;
24
+ /**
25
+ * Create a message pattern for a localization key defined in an `.editor_localization` file; the actual localization happens when the returned value is stringified
26
+ *
27
+ * @param key - localization key defined in an `.editor_localization` file
28
+ * @param vars - optional table with variables to be substituted in the localized string that uses ICU Message Format syntax; keys must be strings; values must be either `nil`, `boolean`, `number`, `string`, or another `message` instance
29
+ * @returns a userdata value that, when stringified with `tostring()`, will produce a localized text according to the currently selected language in the editor
30
+ */
31
+ function message(key: string, vars?: Record<string | number, unknown>): Opaque<"message">;
32
+ /**
33
+ * Create a message pattern that renders a list with the "or" conjunction (for example: a, b, or c) once it is stringified
34
+ *
35
+ * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
36
+ * @returns a userdata value that, when stringified with `tostring()`, will produce a localized text according to the currently selected language in the editor
37
+ */
38
+ function or_list(items: unknown[]): Opaque<"message">;
39
+ }
40
+ }
41
+
42
+ export {};