@defold-typescript/types 0.19.4 → 0.20.1

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 (93) 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/buffer.d.ts +1 -1
  13. package/generated/builtin-messages.d.ts +18 -0
  14. package/generated/camera.d.ts +62 -5
  15. package/generated/compute.d.ts +306 -0
  16. package/generated/crash.d.ts +2 -2
  17. package/generated/go.d.ts +31 -6
  18. package/generated/graphics.d.ts +95 -0
  19. package/generated/gui.d.ts +4 -6
  20. package/generated/image.d.ts +3 -3
  21. package/generated/json.d.ts +2 -2
  22. package/generated/kinds/gui-script.d.ts +7 -0
  23. package/generated/kinds/render-script.d.ts +7 -0
  24. package/generated/kinds/script.d.ts +7 -0
  25. package/generated/label.d.ts +1 -1
  26. package/generated/liveupdate.d.ts +22 -4
  27. package/generated/material.d.ts +444 -0
  28. package/generated/model.d.ts +46 -5
  29. package/generated/physics.d.ts +2 -4
  30. package/generated/profiler.d.ts +2 -3
  31. package/generated/render.d.ts +25 -9
  32. package/generated/resource.d.ts +2 -2
  33. package/generated/socket.d.ts +35 -35
  34. package/generated/sprite.d.ts +15 -1
  35. package/generated/sys.d.ts +1 -1
  36. package/generated/tilemap.d.ts +14 -0
  37. package/generated/timer.d.ts +1 -1
  38. package/generated/versions/defold-1.12.4/b2d.d.ts +27 -0
  39. package/generated/versions/defold-1.12.4/b2d_body.d.ts +348 -0
  40. package/generated/versions/defold-1.12.4/buffer.d.ts +176 -0
  41. package/generated/versions/defold-1.12.4/camera.d.ts +245 -0
  42. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +146 -0
  43. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +71 -0
  44. package/generated/versions/defold-1.12.4/crash.d.ts +143 -0
  45. package/generated/versions/defold-1.12.4/factory.d.ts +123 -0
  46. package/generated/versions/defold-1.12.4/font.d.ts +81 -0
  47. package/generated/versions/defold-1.12.4/go.d.ts +1029 -0
  48. package/generated/versions/defold-1.12.4/graphics.d.ts +226 -0
  49. package/generated/versions/defold-1.12.4/gui.d.ts +2372 -0
  50. package/generated/versions/defold-1.12.4/html5.d.ts +53 -0
  51. package/generated/versions/defold-1.12.4/http.d.ts +84 -0
  52. package/generated/versions/defold-1.12.4/iac.d.ts +18 -0
  53. package/generated/versions/defold-1.12.4/iap.d.ts +60 -0
  54. package/generated/versions/defold-1.12.4/image.d.ts +139 -0
  55. package/generated/versions/defold-1.12.4/index.d.ts +41 -0
  56. package/generated/versions/defold-1.12.4/json.d.ts +76 -0
  57. package/generated/versions/defold-1.12.4/label.d.ts +94 -0
  58. package/generated/versions/defold-1.12.4/liveupdate.d.ts +122 -0
  59. package/generated/versions/defold-1.12.4/model.d.ts +205 -0
  60. package/generated/versions/defold-1.12.4/msg.d.ts +10 -0
  61. package/generated/versions/defold-1.12.4/particlefx.d.ts +166 -0
  62. package/generated/versions/defold-1.12.4/physics.d.ts +547 -0
  63. package/generated/versions/defold-1.12.4/profiler.d.ts +234 -0
  64. package/generated/versions/defold-1.12.4/push.d.ts +66 -0
  65. package/generated/versions/defold-1.12.4/render.d.ts +1149 -0
  66. package/generated/versions/defold-1.12.4/resource.d.ts +1518 -0
  67. package/generated/versions/defold-1.12.4/socket.d.ts +795 -0
  68. package/generated/versions/defold-1.12.4/sound.d.ts +291 -0
  69. package/generated/versions/defold-1.12.4/sprite.d.ts +143 -0
  70. package/generated/versions/defold-1.12.4/sys.d.ts +695 -0
  71. package/generated/versions/defold-1.12.4/tilemap.d.ts +181 -0
  72. package/generated/versions/defold-1.12.4/timer.d.ts +114 -0
  73. package/generated/versions/defold-1.12.4/types.d.ts +61 -0
  74. package/generated/versions/defold-1.12.4/vmath.d.ts +806 -0
  75. package/generated/versions/defold-1.12.4/webview.d.ts +68 -0
  76. package/generated/versions/defold-1.12.4/window.d.ts +198 -0
  77. package/generated/versions/defold-1.12.4/zlib.d.ts +40 -0
  78. package/index.d.ts +22 -0
  79. package/package.json +8 -1
  80. package/scripts/fidelity-audit.ts +69 -12
  81. package/scripts/fidelity-baseline.json +56 -0
  82. package/scripts/generate-api-availability.ts +139 -0
  83. package/scripts/generate-api-signatures.ts +66 -0
  84. package/scripts/import-defold-release.ts +480 -0
  85. package/scripts/materialize-version.ts +45 -20
  86. package/scripts/regen.ts +53 -6
  87. package/scripts/sync-api-docs.ts +89 -41
  88. package/src/api-availability.ts +0 -0
  89. package/src/core-types.ts +9 -0
  90. package/src/emit-dts.ts +685 -17
  91. package/src/emit-messages.ts +72 -2
  92. package/src/index.ts +26 -1
  93. package/src/lifecycle.ts +43 -2
@@ -0,0 +1,53 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * HTML5 platform specific functions.
5
+ *
6
+ * [icon:html5] The following functions are only available on HTML5 builds, the `html5.*` Lua namespace will not be available on other platforms.
7
+ */
8
+ namespace html5 {
9
+ /**
10
+ * Executes the supplied string as JavaScript inside the browser.
11
+ * A call to this function is blocking, the result is returned as-is, as a string.
12
+ * (Internally this will execute the string using the `eval()` JavaScript function.)
13
+ *
14
+ * @param code - Javascript code to run
15
+ * @returns result as string
16
+ * @example
17
+ * ```ts
18
+ * const res = html5.run("10 + 20"); // returns the string "30"
19
+ * print(res);
20
+ * const res_num = tonumber(res); // convert to number
21
+ * print(res_num - 20); // prints 10
22
+ * ```
23
+ */
24
+ function run(code: string): string;
25
+ /**
26
+ * Set a JavaScript interaction listener callaback from lua that will be
27
+ * invoked when a user interacts with the web page by clicking, touching or typing.
28
+ * The callback can then call DOM restricted actions like requesting a pointer lock,
29
+ * or start playing sounds the first time the callback is invoked.
30
+ *
31
+ * @param callback - The interaction callback. Pass an empty function or `nil` if you no longer wish to receive callbacks.
32
+ *
33
+ * `self`
34
+ * object The calling script
35
+ * @example
36
+ * ```ts
37
+ * function on_interaction(self) {
38
+ * print("on_interaction called");
39
+ * html5.set_interaction_listener(undefined);
40
+ * }
41
+ *
42
+ * export default defineScript({
43
+ * init() {
44
+ * html5.set_interaction_listener(on_interaction);
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ function set_interaction_listener(callback?: (self: unknown) => void): void;
50
+ }
51
+ }
52
+
53
+ export {};
@@ -0,0 +1,84 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Functions for performing HTTP and HTTPS requests.
5
+ */
6
+ namespace http {
7
+ /**
8
+ * Perform a HTTP/HTTPS request.
9
+ * If no timeout value is passed, the configuration value "network.http_timeout" is used. If that is not set, the timeout value is `0` (which blocks indefinitely).
10
+ *
11
+ * @param url - target url
12
+ * @param method - HTTP/HTTPS method, e.g. "GET", "PUT", "POST" etc.
13
+ * @param callback - response callback function
14
+ *
15
+ * `self`
16
+ * object The script instance
17
+ * `id`
18
+ * hash Internal message identifier. Do not use!
19
+ * `response`
20
+ * table The response data. Contains the fields:
21
+ *
22
+ * - number `status`: the status of the response
23
+ *
24
+ * - string `response`: the response data (if not saved on disc)
25
+ *
26
+ * - table `headers`: all the returned headers (if status is 200 or 206)
27
+ *
28
+ * - string `path`: the stored path (if saved to disc)
29
+ *
30
+ * - string `error`: if any unforeseen errors occurred (e.g. file I/O)
31
+ *
32
+ * - number `bytes_received`: the amount of bytes received/sent for a request, only if option `report_progress` is true
33
+ *
34
+ * - number `bytes_total`: the total amount of bytes for a request, only if option `report_progress` is true
35
+ *
36
+ * - number `range_start`: the start offset into the requested file
37
+ *
38
+ * - number `range_end`: the end offset into the requested file (inclusive)
39
+ *
40
+ * - number `document_size`: the full size of the requested file
41
+ * @param headers - optional table with custom headers
42
+ * @param post_data - optional data to send
43
+ * @param options - optional table with request parameters. Supported entries:
44
+ *
45
+ * - number `timeout`: timeout in seconds
46
+ *
47
+ * - string `path`: path on disc where to download the file. Only overwrites the path if status is 200. Path should be absolute
48
+ *
49
+ * - boolean `ignore_cache`: don't return cached data if we get a 304. Not available in HTML5 build
50
+ *
51
+ * - boolean `chunked_transfer`: use chunked transfer encoding for https requests larger than 16kb. Defaults to true. Not available in HTML5 build
52
+ *
53
+ * - boolean `report_progress`: when it is true, the amount of bytes sent and/or received for a request will be passed into the callback function
54
+ * @example
55
+ * ```ts
56
+ * // Basic HTTP-GET request. The callback receives a table with the response
57
+ * // in the fields status, the response (the data) and headers (a table).
58
+ * export default defineScript({
59
+ * init() {
60
+ * http.request(
61
+ * "http://www.google.com",
62
+ * "GET",
63
+ * (self, _id, response) => {
64
+ * if (response.bytes_total !== undefined) {
65
+ * update_my_progress_bar(self, response.bytes_received / response.bytes_total);
66
+ * } else {
67
+ * print(response.status);
68
+ * print(response.response);
69
+ * pprint(response.headers);
70
+ * }
71
+ * },
72
+ * undefined,
73
+ * undefined,
74
+ * { report_progress: true },
75
+ * );
76
+ * },
77
+ * });
78
+ * ```
79
+ */
80
+ function request(url: string, method: string, callback: (self: unknown, id: unknown, response: unknown) => void, headers?: LuaMap<string, string>, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean }): void;
81
+ }
82
+ }
83
+
84
+ export {};
@@ -0,0 +1,18 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Functions and constants for doing inter-app communication. Supported on iOS and Android. [icon:ios] [icon:android]
5
+ */
6
+ namespace iac {
7
+ /**
8
+ * Sets the listener function for inter-app communication events.
9
+ *
10
+ * @param payload - The iac payload.
11
+ * @param type - The type of iac, an iac.TYPE_ enumeration. It can be one of the predefined constants below
12
+ * - `iac.TYPE_INVOCATION`
13
+ */
14
+ function set_listener(payload: Record<string | number, unknown>, type: number): void;
15
+ }
16
+ }
17
+
18
+ export {};
@@ -0,0 +1,60 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions and constants for doing in-app purchases. Supported on iOS, Android (Google Play and Amazon) and Facebook Canvas platforms. [icon:ios] [icon:googleplay] [icon:amazon] [icon:facebook]
7
+ */
8
+ namespace iap {
9
+ /**
10
+ * Acknowledge a transaction. [icon:attention] Calling iap.acknowledge is required on a successful transaction on Google Play unless iap.finish is called. The transaction.state field must equal iap.TRANS_STATE_PURCHASED.
11
+ *
12
+ * @param transaction - transaction table parameter as supplied in listener callback
13
+ */
14
+ function acknowledge(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
15
+ /**
16
+ * Purchase a product.
17
+ *
18
+ * @param id - product to buy
19
+ * @param options - optional parameters as properties. The following parameters can be set
20
+ */
21
+ function buy(id: string, options: { request_id?: string; token?: string }): void;
22
+ /**
23
+ * Explicitly finish a product transaction. [icon:attention] Calling iap.finish is required on a successful transaction if `auto_finish_transactions` is disabled in project settings. Calling this function with `auto_finish_transactions` set will be ignored and a warning is printed. The `transaction.state` field must equal `iap.TRANS_STATE_PURCHASED`.
24
+ *
25
+ * @param transaction - transaction table parameter as supplied in listener callback
26
+ */
27
+ function finish(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
28
+ /**
29
+ * Get current iap provider
30
+ *
31
+ * @returns one of the following values
32
+ * - `iap.PROVIDER_ID_GOOGLE`
33
+ * - `iap.PROVIDER_ID_AMAZON`
34
+ * - `iap.PROVIDER_ID_APPLE`
35
+ * - `iap.PROVIDER_ID_FACEBOOK`
36
+ */
37
+ function get_provider_id(): Opaque<"constant">;
38
+ /**
39
+ * Get a list of all avaliable iap products.
40
+ *
41
+ * @param ids - table (array) of identifiers to get products from
42
+ * @param callback - result callback taking the following parameters
43
+ */
44
+ function list(ids: string[], callback: (...args: unknown[]) => unknown): void;
45
+ /**
46
+ * Restore previously purchased products.
47
+ *
48
+ * @returns value is `true` if current store supports handling restored transactions, otherwise `false`.
49
+ */
50
+ function restore(): boolean;
51
+ /**
52
+ * Set the callback function to receive purchase transaction events.
53
+ *
54
+ * @param listener - listener callback function. Pass an empty function if you no longer wish to receive callbacks.
55
+ */
56
+ function set_listener(listener: (...args: unknown[]) => unknown): void;
57
+ }
58
+ }
59
+
60
+ export {};
@@ -0,0 +1,139 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions for creating image objects.
7
+ */
8
+ namespace image {
9
+ /**
10
+ * luminance image type
11
+ */
12
+ const TYPE_LUMINANCE: number & { readonly __brand: "image.TYPE_LUMINANCE" };
13
+ /**
14
+ * luminance image type
15
+ */
16
+ const TYPE_LUMINANCE_ALPHA: number & { readonly __brand: "image.TYPE_LUMINANCE_ALPHA" };
17
+ /**
18
+ * RGB image type
19
+ */
20
+ const TYPE_RGB: number & { readonly __brand: "image.TYPE_RGB" };
21
+ /**
22
+ * RGBA image type
23
+ */
24
+ const TYPE_RGBA: number & { readonly __brand: "image.TYPE_RGBA" };
25
+ /**
26
+ * get the header of an .astc buffer
27
+ *
28
+ * @param buffer - .astc file data buffer
29
+ * @returns header or `nil` if buffer is not a valid .astc. The header has these fields:
30
+ *
31
+ * - number `width`: image width
32
+ *
33
+ * - number `height`: image height
34
+ *
35
+ * - number `depth`: image depth
36
+ *
37
+ * - number `block_size_x`: block size x
38
+ *
39
+ * - number `block_size_y`: block size y
40
+ *
41
+ * - number `block_size_z`: block size z
42
+ * @example
43
+ * ```ts
44
+ * // How to get the block size and dimensions from a .astc file
45
+ * const [s] = sys.load_resource("/assets/cat.astc");
46
+ * const header = image.get_astc_header(s);
47
+ * pprint(s);
48
+ * ```
49
+ */
50
+ function get_astc_header(buffer: string): { width: number; height: number; depth: number; block_size_x: number; block_size_y: number; block_size_z: number } | undefined;
51
+ /**
52
+ * Load image (PNG or JPEG) from buffer.
53
+ *
54
+ * @param buffer - image data buffer
55
+ * @param options - An optional table containing parameters for loading the image. Supported entries:
56
+ *
57
+ * `premultiply_alpha`
58
+ * boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
59
+ * `flip_vertically`
60
+ * boolean True if the image contents should be flipped vertically. Defaults to `false`.
61
+ * @returns object or `nil` if loading fails. The object is a table with the following fields:
62
+ *
63
+ * - number `width`: image width
64
+ *
65
+ * - number `height`: image height
66
+ *
67
+ * - constant `type`: image type
68
+ *
69
+ * - `image.TYPE_RGB`
70
+ *
71
+ * - `image.TYPE_RGBA`
72
+ *
73
+ * - `image.TYPE_LUMINANCE`
74
+ *
75
+ * - `image.TYPE_LUMINANCE_ALPHA`
76
+ *
77
+ * - string `buffer`: the raw image data
78
+ * @example
79
+ * ```ts
80
+ * // How to load an image from an URL and create a GUI texture from it:
81
+ * const imgurl = "http://www.site.com/image.png";
82
+ * http.request(imgurl, "GET", (self, id, response) => {
83
+ * const img = image.load(response.response);
84
+ * const tx = gui.new_texture("image_node", img.width, img.height, img.type, img.buffer);
85
+ * });
86
+ * ```
87
+ */
88
+ function load(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: string } | undefined;
89
+ /**
90
+ * Load image (PNG or JPEG) from a string buffer.
91
+ *
92
+ * @param buffer - image data buffer
93
+ * @param options - An optional table containing parameters for loading the image. Supported entries:
94
+ *
95
+ * `premultiply_alpha`
96
+ * boolean True if alpha should be premultiplied into the color components. Defaults to `false`.
97
+ * `flip_vertically`
98
+ * boolean True if the image contents should be flipped vertically. Defaults to `false`.
99
+ * @returns object or `nil` if loading fails. The object is a table with the following fields:
100
+ *
101
+ * - number `width`: image width
102
+ *
103
+ * - number `height`: image height
104
+ *
105
+ * - constant `type`: image type
106
+ *
107
+ * - `image.TYPE_RGB`
108
+ *
109
+ * - `image.TYPE_RGBA`
110
+ *
111
+ * - `image.TYPE_LUMINANCE`
112
+ *
113
+ * - `image.TYPE_LUMINANCE_ALPHA`
114
+ *
115
+ * - buffer `buffer`: the script buffer that holds the decompressed image data. See buffer.create how to use the buffer.
116
+ * @example
117
+ * ```ts
118
+ * // Load an image from an URL as a buffer and create a texture resource from it:
119
+ * const imgurl = "http://www.site.com/image.png";
120
+ * http.request(imgurl, "GET", (self, id, response) => {
121
+ * const img = image.load_buffer(response.response, { flip_vertically: true });
122
+ * const tparams = {
123
+ * width: img.width,
124
+ * height: img.height,
125
+ * type: graphics.TEXTURE_TYPE_2D,
126
+ * format: graphics.TEXTURE_FORMAT_RGBA,
127
+ * };
128
+ *
129
+ * const my_texture_id = resource.create_texture("/my_custom_texture.texturec", tparams, img.buffer);
130
+ * // Apply the texture to a model
131
+ * go.set("/go1#model", "texture0", my_texture_id);
132
+ * });
133
+ * ```
134
+ */
135
+ function load_buffer(buffer: string, options?: { premultiply_alpha?: boolean; flip_vertically?: boolean }): { width: number; height: number; type: Opaque<"constant">; buffer: Opaque<"buffer"> } | undefined;
136
+ }
137
+ }
138
+
139
+ export {};
@@ -0,0 +1,41 @@
1
+ import "./b2d";
2
+ import "./b2d_body";
3
+ import "./buffer";
4
+ import "./camera";
5
+ import "./collectionfactory";
6
+ import "./collectionproxy";
7
+ import "./crash";
8
+ import "./factory";
9
+ import "./font";
10
+ import "./go";
11
+ import "./graphics";
12
+ import "./gui";
13
+ import "./html5";
14
+ import "./http";
15
+ import "./iac";
16
+ import "./iap";
17
+ import "./image";
18
+ import "./json";
19
+ import "./label";
20
+ import "./liveupdate";
21
+ import "./model";
22
+ import "./msg";
23
+ import "./particlefx";
24
+ import "./physics";
25
+ import "./profiler";
26
+ import "./push";
27
+ import "./render";
28
+ import "./resource";
29
+ import "./socket";
30
+ import "./sound";
31
+ import "./sprite";
32
+ import "./sys";
33
+ import "./tilemap";
34
+ import "./timer";
35
+ import "./types";
36
+ import "./vmath";
37
+ import "./webview";
38
+ import "./window";
39
+ import "./zlib";
40
+
41
+ export {};
@@ -0,0 +1,76 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Manipulation of JSON data strings.
5
+ */
6
+ namespace json {
7
+ /**
8
+ * Represents the null primitive from a json file
9
+ */
10
+ const _null: unknown;
11
+ /**
12
+ * Decode a string of JSON data into a Lua table.
13
+ * A Lua error is raised for syntax errors.
14
+ *
15
+ * @param json - json data
16
+ * @param options - table with decode options
17
+ *
18
+ * - boolean `decode_null_as_userdata`: wether to decode a JSON null value as json.null or nil (default is nil)
19
+ * @returns decoded json
20
+ * @example
21
+ * ```ts
22
+ * // Converting a string containing JSON data into a table:
23
+ * export default defineScript({
24
+ * init() {
25
+ * const jsonstring = '{"persons":[{"name":"John Doe"},{"name":"Darth Vader"}]}';
26
+ * const data = json.decode(jsonstring);
27
+ * pprint(data);
28
+ * },
29
+ * });
30
+ *
31
+ * // Results in the following printout:
32
+ * // {
33
+ * // persons = {
34
+ * // 1 = {
35
+ * // name = John Doe,
36
+ * // }
37
+ * // 2 = {
38
+ * // name = Darth Vader,
39
+ * // }
40
+ * // }
41
+ * // }
42
+ * ```
43
+ */
44
+ export function decode(json: string, options?: { decode_null_as_userdata?: boolean }): Record<string | number, unknown>;
45
+ /**
46
+ * Encode a lua table to a JSON string.
47
+ * A Lua error is raised for syntax errors.
48
+ *
49
+ * @param tbl - lua table to encode
50
+ * @param options - table with encode options
51
+ *
52
+ * - string `encode_empty_table_as_object`: wether to encode an empty table as an JSON object or array (default is object)
53
+ * @returns encoded json
54
+ * @example
55
+ * ```ts
56
+ * // Convert a table to a JSON string:
57
+ * export default defineScript({
58
+ * init() {
59
+ * const tbl = {
60
+ * persons: [{ name: "John Doe" }, { name: "Darth Vader" }],
61
+ * };
62
+ * const jsonstring = json.encode(tbl);
63
+ * pprint(jsonstring);
64
+ * },
65
+ * });
66
+ *
67
+ * // Results in the following printout:
68
+ * // {"persons":[{"name":"John Doe"},{"name":"Darth Vader"}]}
69
+ * ```
70
+ */
71
+ export function encode(tbl: Record<string | number, unknown>, options?: { encode_empty_table_as_object?: string }): string;
72
+ export { _null as null };
73
+ }
74
+ }
75
+
76
+ export {};
@@ -0,0 +1,94 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Url, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions to manipulate a label component.
7
+ */
8
+ namespace label {
9
+ /**
10
+ * Gets the text from a label component
11
+ *
12
+ * @param url - the label to get the text from
13
+ * @returns the label text
14
+ * @example
15
+ * ```ts
16
+ * export default defineScript({
17
+ * init(self) {
18
+ * const text = label.get_text("#label");
19
+ * print(text);
20
+ * },
21
+ * });
22
+ * ```
23
+ */
24
+ function get_text(url: string | Hash | Url): string;
25
+ /**
26
+ * Sets the text of a label component
27
+ * This method uses the message passing that means the value will be set after `dispatch messages` step.
28
+ * More information is available in the Application Lifecycle manual.
29
+ *
30
+ * @param url - the label that should have a constant set
31
+ * @param text - the text
32
+ * @example
33
+ * ```ts
34
+ * export default defineScript({
35
+ * init(self) {
36
+ * label.set_text("#label", "Hello World!");
37
+ * },
38
+ * });
39
+ * ```
40
+ */
41
+ function set_text(url: string | Hash | Url, text: string | number): void;
42
+ interface properties {
43
+ /**
44
+ * The color of the label. The type of the property is vector4.
45
+ */
46
+ color: Vector4;
47
+ /**
48
+ * The font used when rendering the label. The type of the property is hash.
49
+ */
50
+ font: Hash;
51
+ /**
52
+ * The leading of the label. This value is used to scale the line spacing of text.
53
+ * The type of the property is number.
54
+ */
55
+ leading: number;
56
+ /**
57
+ * The line break of the label.
58
+ * This value is used to adjust the vertical spacing of characters in the text.
59
+ * The type of the property is boolean.
60
+ */
61
+ line_break: boolean;
62
+ /**
63
+ * The material used when rendering the label. The type of the property is hash.
64
+ */
65
+ material: Hash;
66
+ /**
67
+ * The outline color of the label. The type of the property is vector4.
68
+ */
69
+ outline: Vector4;
70
+ /**
71
+ * The scale of the label. The type of the property is number (uniform)
72
+ * or vector3 (non uniform).
73
+ */
74
+ scale: number | Vector3;
75
+ /**
76
+ * The shadow color of the label. The type of the property is vector4.
77
+ */
78
+ shadow: Vector4;
79
+ /**
80
+ * Returns the size of the label. The size will constrain the text if line break is enabled.
81
+ * The type of the property is vector3.
82
+ */
83
+ size: Vector3;
84
+ /**
85
+ * The tracking of the label.
86
+ * This value is used to adjust the vertical spacing of characters in the text.
87
+ * The type of the property is number.
88
+ */
89
+ tracking: number;
90
+ }
91
+ }
92
+ }
93
+
94
+ export {};
@@ -0,0 +1,122 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Functions and constants to access resources.
5
+ */
6
+ namespace liveupdate {
7
+ /**
8
+ * Mismatch between between expected bundled resources and actual bundled resources. The manifest expects a resource to be in the bundle, but it was not found in the bundle. This is typically the case when a non-excluded resource was modified between publishing the bundle and publishing the manifest.
9
+ */
10
+ const LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH" };
11
+ /**
12
+ * Mismatch between running engine version and engine versions supported by manifest.
13
+ */
14
+ const LIVEUPDATE_ENGINE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_ENGINE_VERSION_MISMATCH" };
15
+ /**
16
+ * Failed to parse manifest data buffer. The manifest was probably produced by a different engine version.
17
+ */
18
+ const LIVEUPDATE_FORMAT_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_FORMAT_ERROR" };
19
+ /**
20
+ * Argument was invalid
21
+ */
22
+ const LIVEUPDATE_INVAL: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVAL" };
23
+ /**
24
+ * The handled resource is invalid.
25
+ */
26
+ const LIVEUPDATE_INVALID_HEADER: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_HEADER" };
27
+ /**
28
+ * The header of the resource is invalid.
29
+ */
30
+ const LIVEUPDATE_INVALID_RESOURCE: number & { readonly __brand: "liveupdate.LIVEUPDATE_INVALID_RESOURCE" };
31
+ /**
32
+ * I/O operation failed
33
+ */
34
+ const LIVEUPDATE_IO_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_IO_ERROR" };
35
+ /**
36
+ * Memory wasn't allocated
37
+ */
38
+ const LIVEUPDATE_MEM_ERROR: number & { readonly __brand: "liveupdate.LIVEUPDATE_MEM_ERROR" };
39
+ /**
40
+ * LIVEUPDATE_OK
41
+ */
42
+ const LIVEUPDATE_OK: number & { readonly __brand: "liveupdate.LIVEUPDATE_OK" };
43
+ /**
44
+ * Mismatch between scheme used to load resources. Resources are loaded with a different scheme than from manifest, for example over HTTP or directly from file. This is typically the case when running the game directly from the editor instead of from a bundle.
45
+ */
46
+ const LIVEUPDATE_SCHEME_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SCHEME_MISMATCH" };
47
+ /**
48
+ * Mismatch between expected and actual integrity data for legacy liveupdate verification.
49
+ */
50
+ const LIVEUPDATE_SIGNATURE_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_SIGNATURE_MISMATCH" };
51
+ /**
52
+ * Unspecified error
53
+ */
54
+ const LIVEUPDATE_UNKNOWN: number & { readonly __brand: "liveupdate.LIVEUPDATE_UNKNOWN" };
55
+ /**
56
+ * Mismatch between manifest expected version and actual version.
57
+ */
58
+ const LIVEUPDATE_VERSION_MISMATCH: number & { readonly __brand: "liveupdate.LIVEUPDATE_VERSION_MISMATCH" };
59
+ /**
60
+ * Adds a resource mount to the resource system.
61
+ * The mounts are persisted between sessions.
62
+ * After the mount succeeded, the resources are available to load. (i.e. no reboot required)
63
+ *
64
+ * @param name - Unique name of the mount
65
+ * @param uri - The uri of the mount, including the scheme. Currently supported schemes are 'zip' and 'archive'.
66
+ * @param priority - Priority of mount. Larger priority takes prescedence
67
+ * @param callback - Callback after the asynchronous request completed
68
+ * @returns The result of the request
69
+ * @example
70
+ * ```lua
71
+ * Add multiple mounts. Higher priority takes precedence.
72
+ * liveupdate.add_mount("common", "zip:/path/to/common_stuff.zip", 10, function (result) end) -- base pack
73
+ * liveupdate.add_mount("levelpack_1", "zip:/path/to/levels_1_to_20.zip", 20, function (result) end) -- level pack
74
+ * liveupdate.add_mount("season_pack_1", "zip:/path/to/easter_pack_1.zip", 30, function (result) end) -- season pack, overriding content in the other packs
75
+ * ```
76
+ */
77
+ function add_mount(name: string, uri: string, priority: number, callback: (...args: unknown[]) => unknown): number;
78
+ /**
79
+ * Get an array of the current mounts
80
+ * This can be used to determine if a new mount is needed or not
81
+ *
82
+ * @returns Array of mounts
83
+ * @example
84
+ * ```lua
85
+ * Output the current resource mounts
86
+ * pprint("MOUNTS", liveupdate.get_mounts())
87
+ *
88
+ * Give an output like:
89
+ * DEBUG:SCRIPT: MOUNTS,
90
+ * { --[[0x119667bf0]]
91
+ * 1 = { --[[0x119667c50]]
92
+ * name = "liveupdate",
93
+ * uri = "zip:/device/path/to/acchives/liveupdate.zip",
94
+ * priority = 5
95
+ * },
96
+ * 2 = { --[[0x119667d50]]
97
+ * name = "_base",
98
+ * uri = "archive:build/default/game.dmanifest",
99
+ * priority = -10
100
+ * }
101
+ * }
102
+ * ```
103
+ */
104
+ function get_mounts(): { name: string; uri: string; priority: number }[];
105
+ /**
106
+ * Remove a mount the resource system.
107
+ * The remaining mounts are persisted between sessions.
108
+ * Removing a mount does not affect any loaded resources.
109
+ *
110
+ * @param name - Unique name of the mount
111
+ * @returns The result of the call
112
+ * @example
113
+ * ```ts
114
+ * // Add multiple mounts. Higher priority takes precedence.
115
+ * liveupdate.remove_mount("season_pack_1");
116
+ * ```
117
+ */
118
+ function remove_mount(name: string): number;
119
+ }
120
+ }
121
+
122
+ export {};