@defold-typescript/types 0.49.0 → 0.50.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 (76) hide show
  1. package/api-availability.json +696 -624
  2. package/api-signatures.json +6799 -160
  3. package/api-targets.json +393 -2
  4. package/examples/translations.json +12 -0
  5. package/generated/b2d.d.ts +15 -0
  6. package/generated/bullet3d.d.ts +16 -0
  7. package/generated/font.d.ts +7 -3
  8. package/generated/graphics.d.ts +7 -0
  9. package/generated/gui.d.ts +5 -4
  10. package/generated/label.d.ts +3 -3
  11. package/generated/render.d.ts +16 -1
  12. package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
  13. package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
  14. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
  15. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
  16. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
  17. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
  18. package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
  19. package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
  20. package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
  21. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
  22. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
  23. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
  24. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
  25. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
  26. package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
  27. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
  28. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
  29. package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
  30. package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
  31. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
  32. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
  33. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
  34. package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
  35. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
  36. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
  37. package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
  38. package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
  39. package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
  40. package/generated/versions/defold-1.13.2/font.d.ts +123 -0
  41. package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
  42. package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
  43. package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
  44. package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
  45. package/generated/versions/defold-1.13.2/http.d.ts +83 -0
  46. package/generated/versions/defold-1.13.2/image.d.ts +181 -0
  47. package/generated/versions/defold-1.13.2/index.d.ts +63 -0
  48. package/generated/versions/defold-1.13.2/json.d.ts +94 -0
  49. package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
  50. package/generated/versions/defold-1.13.2/label.d.ts +164 -0
  51. package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
  52. package/generated/versions/defold-1.13.2/material.d.ts +490 -0
  53. package/generated/versions/defold-1.13.2/model.d.ts +287 -0
  54. package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
  56. package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
  57. package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
  58. package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
  59. package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
  60. package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
  61. package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
  62. package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
  63. package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
  64. package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
  65. package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
  66. package/generated/versions/defold-1.13.2/types.d.ts +61 -0
  67. package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
  68. package/generated/versions/defold-1.13.2/window.d.ts +196 -0
  69. package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
  70. package/identity-vocabulary.json +1 -0
  71. package/package.json +2 -2
  72. package/scripts/import-defold-release.ts +3 -31
  73. package/scripts/materialize-version.ts +13 -7
  74. package/scripts/regen.ts +63 -29
  75. package/scripts/sync-api-docs.ts +31 -2
  76. package/src/emit-dts.ts +25 -3
@@ -0,0 +1,157 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Native crash logging functions and constants.
5
+ */
6
+ namespace crash {
7
+ /**
8
+ * Loaded crash module
9
+ */
10
+ interface module_info {
11
+ /**
12
+ * module name
13
+ */
14
+ name: string;
15
+ /**
16
+ * module load address
17
+ */
18
+ address: string;
19
+ }
20
+ type USERFIELD = number;
21
+ type SYSFIELD = typeof crash.SYSFIELD_ENGINE_VERSION | typeof crash.SYSFIELD_ENGINE_HASH | typeof crash.SYSFIELD_DEVICE_MODEL | typeof crash.SYSFIELD_MANUFACTURER | typeof crash.SYSFIELD_SYSTEM_NAME | typeof crash.SYSFIELD_SYSTEM_VERSION | typeof crash.SYSFIELD_LANGUAGE | typeof crash.SYSFIELD_DEVICE_LANGUAGE | typeof crash.SYSFIELD_TERRITORY | typeof crash.SYSFIELD_ANDROID_BUILD_FINGERPRINT;
22
+ /**
23
+ * android build fingerprint
24
+ */
25
+ const SYSFIELD_ANDROID_BUILD_FINGERPRINT: number & { readonly __brand: "crash.SYSFIELD_ANDROID_BUILD_FINGERPRINT" };
26
+ /**
27
+ * system device language as reported by sys.get_sys_info
28
+ */
29
+ const SYSFIELD_DEVICE_LANGUAGE: number & { readonly __brand: "crash.SYSFIELD_DEVICE_LANGUAGE" };
30
+ /**
31
+ * device model as reported by sys.get_sys_info
32
+ */
33
+ const SYSFIELD_DEVICE_MODEL: number & { readonly __brand: "crash.SYSFIELD_DEVICE_MODEL" };
34
+ /**
35
+ * engine version as hash
36
+ */
37
+ const SYSFIELD_ENGINE_HASH: number & { readonly __brand: "crash.SYSFIELD_ENGINE_HASH" };
38
+ /**
39
+ * engine version as release number
40
+ */
41
+ const SYSFIELD_ENGINE_VERSION: number & { readonly __brand: "crash.SYSFIELD_ENGINE_VERSION" };
42
+ /**
43
+ * system language as reported by sys.get_sys_info
44
+ */
45
+ const SYSFIELD_LANGUAGE: number & { readonly __brand: "crash.SYSFIELD_LANGUAGE" };
46
+ /**
47
+ * device manufacturer as reported by sys.get_sys_info
48
+ */
49
+ const SYSFIELD_MANUFACTURER: number & { readonly __brand: "crash.SYSFIELD_MANUFACTURER" };
50
+ /**
51
+ * The max number of sysfields.
52
+ */
53
+ const SYSFIELD_MAX: number & { readonly __brand: "crash.SYSFIELD_MAX" };
54
+ /**
55
+ * system name as reported by sys.get_sys_info
56
+ */
57
+ const SYSFIELD_SYSTEM_NAME: number & { readonly __brand: "crash.SYSFIELD_SYSTEM_NAME" };
58
+ /**
59
+ * system version as reported by sys.get_sys_info
60
+ */
61
+ const SYSFIELD_SYSTEM_VERSION: number & { readonly __brand: "crash.SYSFIELD_SYSTEM_VERSION" };
62
+ /**
63
+ * system territory as reported by sys.get_sys_info
64
+ */
65
+ const SYSFIELD_TERRITORY: number & { readonly __brand: "crash.SYSFIELD_TERRITORY" };
66
+ /**
67
+ * The max number of user fields.
68
+ */
69
+ const USERFIELD_MAX: number & { readonly __brand: "crash.USERFIELD_MAX" };
70
+ /**
71
+ * The max size of a single user field.
72
+ */
73
+ const USERFIELD_SIZE: number & { readonly __brand: "crash.USERFIELD_SIZE" };
74
+ /**
75
+ * A table is returned containing the addresses of the call stack.
76
+ *
77
+ * @param handle - crash dump handle
78
+ * @returns table containing the backtrace
79
+ */
80
+ function get_backtrace(handle: number): string[];
81
+ /**
82
+ * The format of read text blob is platform specific
83
+ * and not guaranteed
84
+ * but can be useful for manual inspection.
85
+ *
86
+ * @param handle - crash dump handle
87
+ * @returns string with the platform specific data
88
+ */
89
+ function get_extra_data(handle: number): string;
90
+ /**
91
+ * get all loaded modules from when the crash occured
92
+ *
93
+ * @param handle - crash dump handle
94
+ * @returns loaded modules
95
+ */
96
+ function get_modules(handle: number): crash.module_info[];
97
+ /**
98
+ * read signal number from a crash report
99
+ *
100
+ * @param handle - crash dump handle
101
+ * @returns signal number
102
+ */
103
+ function get_signum(handle: number): number;
104
+ /**
105
+ * reads a system field from a loaded crash dump
106
+ *
107
+ * @param handle - crash dump handle
108
+ * @param index - system field enum. Must be less than crash.SYSFIELD_MAX
109
+ * @returns value recorded in the crash dump, or `nil` if it didn't exist
110
+ */
111
+ function get_sys_field(handle: number, index: crash.SYSFIELD): string | undefined;
112
+ /**
113
+ * reads user field from a loaded crash dump
114
+ *
115
+ * @param handle - crash dump handle
116
+ * @param index - user data slot index. **0️⃣ 0-based; passed to Defold unchanged.**
117
+ * @returns user data value recorded in the crash dump
118
+ */
119
+ function get_user_field(handle: number, index: crash.USERFIELD): string;
120
+ /**
121
+ * The crash dump will be removed from disk upon a successful
122
+ * load, so loading is one-shot.
123
+ *
124
+ * @returns handle to the loaded dump, or `nil` if no dump was found
125
+ */
126
+ function load_previous(): number | undefined;
127
+ /**
128
+ * releases a previously loaded crash dump
129
+ *
130
+ * @param handle - handle to loaded crash dump
131
+ */
132
+ function release(handle: number): void;
133
+ /**
134
+ * Crashes occuring before the path is set will be stored to a default engine location.
135
+ *
136
+ * @param path - file path to use
137
+ */
138
+ function set_file_path(path: string): void;
139
+ /**
140
+ * Store a user value that will get written to a crash dump when
141
+ * a crash occurs. This can be user id:s, breadcrumb data etc.
142
+ * There are 32 slots indexed from 0. Each slot stores at most 255 characters.
143
+ *
144
+ * @param index - slot index. 0-indexed. **0️⃣ 0-based; passed to Defold unchanged.**
145
+ * @param value - string value to store
146
+ */
147
+ function set_user_field(index: crash.USERFIELD, value: string): void;
148
+ /**
149
+ * Performs the same steps as if a crash had just occured but
150
+ * allows the program to continue.
151
+ * The generated dump can be read by crash.load_previous
152
+ */
153
+ function write_dump(): void;
154
+ }
155
+ }
156
+
157
+ export {};
@@ -0,0 +1,139 @@
1
+ /** @noSelfInFile */
2
+ import type { Opaque } from "../../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Editor scripting documentation
7
+ */
8
+ namespace http {
9
+ type response = Opaque<"http.response">;
10
+ type route = Opaque<"http.route">;
11
+ /**
12
+ * Perform an HTTP request
13
+ *
14
+ * @param url - request URL
15
+ * @param opts - request options
16
+ * @returns HTTP response
17
+ */
18
+ function request(url: string, opts?: http.request.options): http.request.response;
19
+ namespace request {
20
+ type method = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | string;
21
+ /**
22
+ * Options for http.request
23
+ */
24
+ interface options {
25
+ /**
26
+ * request method, defaults to `"GET"`
27
+ */
28
+ method?: http.request.method;
29
+ /**
30
+ * request headers
31
+ */
32
+ headers?: LuaTable<string, string>;
33
+ /**
34
+ * request body
35
+ */
36
+ body?: string;
37
+ /**
38
+ * response body converter; mutually exclusive with `path`
39
+ */
40
+ as?: "string" | "json";
41
+ /**
42
+ * destination file path, resolved against project root if relative; mutually exclusive with `as`
43
+ */
44
+ path?: string;
45
+ }
46
+ /**
47
+ * Response returned by http.request
48
+ */
49
+ interface response {
50
+ /**
51
+ * response code
52
+ */
53
+ status: number;
54
+ /**
55
+ * response headers, where keys are lowercase and repeated headers have arrays of values
56
+ */
57
+ headers: LuaTable<string, string | string[]>;
58
+ /**
59
+ * response body, present only when the `as` option was provided
60
+ */
61
+ body?: unknown;
62
+ /**
63
+ * resolved absolute destination path, present after a successful response was written using the `path` option
64
+ */
65
+ path?: string;
66
+ }
67
+ }
68
+ namespace server {
69
+ type handler = (request: http.server.request) => LuaMultiReturn<[http.response | number | undefined, LuaTable<string, string> | undefined, string | undefined]>;
70
+ /**
71
+ * HTTP server request
72
+ */
73
+ interface request {
74
+ /**
75
+ * route path parameter extracted from a path pattern
76
+ */
77
+ "[string]": unknown;
78
+ /**
79
+ * full matched path, starting with `/`
80
+ */
81
+ path: string;
82
+ /**
83
+ * HTTP request method, e.g. `"POST"`
84
+ */
85
+ method: string;
86
+ /**
87
+ * request headers, keyed by lowercase header name
88
+ */
89
+ headers: LuaTable<string, string | string[]>;
90
+ /**
91
+ * query string
92
+ */
93
+ query?: string;
94
+ /**
95
+ * request body, whose type depends on the route's `as` argument
96
+ */
97
+ body?: unknown;
98
+ }
99
+ /**
100
+ * Create HTTP response that will stream the content of a file defined by the path
101
+ *
102
+ * @param path - External file path, resolved against project root if relative
103
+ * @param status - HTTP status code, an integer, default 200
104
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
105
+ * @returns HTTP response value, userdata
106
+ */
107
+ function external_file_response(path: string, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
108
+ /**
109
+ * Create HTTP response with a JSON value
110
+ *
111
+ * @param value - Any Lua value that may be represented as JSON
112
+ * @param status - HTTP status code, an integer, default 200
113
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
114
+ * @returns HTTP response value, userdata
115
+ */
116
+ function json_response(value: unknown, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
117
+ /**
118
+ * Create HTTP response that will stream the content of a resource defined by the resource path
119
+ *
120
+ * @param resource_path - Resource path (starting with `/`)
121
+ * @param status - HTTP status code, an integer, default 200
122
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
123
+ * @returns HTTP response value, userdata
124
+ */
125
+ function resource_response(resource_path: string, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
126
+ /**
127
+ * Create HTTP response
128
+ *
129
+ * @param status - HTTP status code, an integer, default 200
130
+ * @param headers - HTTP response headers, a table from lower-case header names to header values
131
+ * @param body - HTTP response body
132
+ * @returns HTTP response value, userdata
133
+ */
134
+ function response(status?: number, headers?: LuaMap<string, string> | Record<string, string>, body?: string): http.response;
135
+ }
136
+ }
137
+ }
138
+
139
+ export {};
@@ -0,0 +1,48 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace image {
7
+ /**
8
+ * Load an image file for reading
9
+ *
10
+ * @param path - External file path, resolved against project root if relative
11
+ * @returns image userdata
12
+ */
13
+ function load_file(path: string): editor.image;
14
+ /**
15
+ * Return the color of a pixel from a loaded image.
16
+ * Coordinates are 1-based, with `1, 1` at the top-left corner.
17
+ *
18
+ * @param image - image userdata returned by `image.load_file()`
19
+ * @param x - 1-based horizontal pixel coordinate. **⚠️ 1-based; passed to Defold unchanged.**
20
+ * @param y - 1-based vertical pixel coordinate. **⚠️ 1-based; passed to Defold unchanged.**
21
+ */
22
+ function pixel(image: editor.image, x: number, y: number): LuaMultiReturn<[number, number, number, number]>;
23
+ /**
24
+ * Iterate over pixels in a loaded image.
25
+ * The iterator returns pixels row by row from top-left to bottom-right. Coordinates are 1-based.
26
+ *
27
+ * @param image - image userdata returned by `image.load_file()`
28
+ * @returns iterator function returning `x, y, r, g, b, a` for each pixel. **⚠️ 1-based; passed to Defold unchanged.**
29
+ * @example
30
+ * ```lua
31
+ * local img = image.load_file("assets/source.png")
32
+ * local width, height = image.size(img)
33
+ * for x, y, r, g, b, a in image.pixels(img) do
34
+ * print(x, y, r, g, b, a)
35
+ * end
36
+ * ```
37
+ */
38
+ function pixels(image: editor.image): (...args: unknown[]) => unknown;
39
+ /**
40
+ * Return the width and height of a loaded image.
41
+ *
42
+ * @param image - image userdata returned by `image.load_file()`
43
+ */
44
+ function size(image: editor.image): LuaMultiReturn<[number, number]>;
45
+ }
46
+ }
47
+
48
+ export {};
@@ -0,0 +1,21 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace json {
7
+ namespace decode {
8
+ /**
9
+ * Options for json.decode
10
+ */
11
+ interface options {
12
+ /**
13
+ * if true, decodes all JSON values in a string and returns an array
14
+ */
15
+ all?: boolean;
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ 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: (undefined | boolean | number | string | Opaque<"message">)[]): 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: (undefined | boolean | number | string | Opaque<"message">)[], 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?: LuaMap<string, undefined | boolean | number | string | Opaque<"message">> | Record<string, undefined | boolean | number | string | Opaque<"message">>): 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: (undefined | boolean | number | string | Opaque<"message">)[]): Opaque<"message">;
39
+ }
40
+ }
41
+
42
+ export {};
@@ -0,0 +1,126 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace tilemap.tiles {
7
+ /**
8
+ * Remove all tiles
9
+ *
10
+ * @param tiles - unbounded 2d grid of tiles
11
+ * @returns unbounded 2d grid of tiles
12
+ */
13
+ export function clear(tiles: editor.tiles): editor.tiles;
14
+ /**
15
+ * Get full information from a tile at a particular coordinate
16
+ *
17
+ * @param tiles - unbounded 2d grid of tiles
18
+ * @param x - x coordinate of a tile
19
+ * @param y - y coordinate of a tile
20
+ * @returns full tile information, or nil if no tile is set at the coordinate. **⚠️ `index` is 1-based; passed to Defold unchanged.**
21
+ */
22
+ export function get_info(tiles: editor.tiles, x: number, y: number): tilemap.tiles.get_info.result | undefined;
23
+ /**
24
+ * Get a tile index at a particular coordinate
25
+ *
26
+ * @param tiles - unbounded 2d grid of tiles
27
+ * @param x - x coordinate of a tile
28
+ * @param y - y coordinate of a tile
29
+ * @returns 1-indexed tile index of a tilemap's tilesource. **⚠️ 1-based; passed to Defold unchanged.**
30
+ */
31
+ export function get_tile(tiles: editor.tiles, x: number, y: number): number;
32
+ /**
33
+ * Create an iterator over all tiles in a tiles data structure
34
+ * When iterating using for loop, each iteration returns x, y and tile index of a tile in a tile map
35
+ *
36
+ * @param tiles - unbounded 2d grid of tiles
37
+ * @returns iterator
38
+ * @example
39
+ * ```lua
40
+ * Iterate over all tiles in a tile map:
41
+ * local layers = editor.get("/level.tilemap", "layers")
42
+ * for i = 1, #layers do
43
+ * local tiles = editor.get(layers[i], "tiles")
44
+ * for x, y, i in tilemap.tiles.iterator(tiles) do
45
+ * print(x, y, i)
46
+ * end
47
+ * end
48
+ * ```
49
+ */
50
+ export function iterator(tiles: editor.tiles): (...args: unknown[]) => unknown;
51
+ /**
52
+ * Create a new unbounded 2d grid data structure for storing tilemap layer tiles
53
+ *
54
+ * @returns unbounded 2d grid of tiles
55
+ */
56
+ function _new(): editor.tiles;
57
+ /**
58
+ * Remove a tile at a particular coordinate
59
+ *
60
+ * @param tiles - unbounded 2d grid of tiles
61
+ * @param x - x coordinate of a tile
62
+ * @param y - y coordinate of a tile
63
+ * @returns unbounded 2d grid of tiles
64
+ */
65
+ export function remove(tiles: editor.tiles, x: number, y: number): editor.tiles;
66
+ /**
67
+ * Set a tile at a particular coordinate
68
+ *
69
+ * @param tiles - unbounded 2d grid of tiles
70
+ * @param x - x coordinate of a tile
71
+ * @param y - y coordinate of a tile
72
+ * @param tile_or_info - Either 1-indexed tile index of a tilemap's tilesource or full tile information. **⚠️ 1-based; passed to Defold unchanged.** **⚠️ `index` is 1-based; passed to Defold unchanged.**
73
+ * @returns unbounded 2d grid of tiles
74
+ */
75
+ export function set(tiles: editor.tiles, x: number, y: number, tile_or_info: number | tilemap.tiles.set.info): editor.tiles;
76
+ export { _new as new };
77
+ export namespace get_info {
78
+ /**
79
+ * Full tile information returned by tilemap.tiles.get_info
80
+ */
81
+ interface result {
82
+ /**
83
+ * 1-indexed tile index of a tilemap's tilesource
84
+ */
85
+ index: number;
86
+ /**
87
+ * horizontal flip
88
+ */
89
+ h_flip: boolean;
90
+ /**
91
+ * vertical flip
92
+ */
93
+ v_flip: boolean;
94
+ /**
95
+ * whether the tile is rotated 90 degrees clockwise
96
+ */
97
+ rotate_90: boolean;
98
+ }
99
+ }
100
+ export namespace set {
101
+ /**
102
+ * Tile information accepted by tilemap.tiles.set
103
+ */
104
+ interface info {
105
+ /**
106
+ * 1-indexed tile index of a tilemap's tilesource
107
+ */
108
+ index: number;
109
+ /**
110
+ * horizontal flip
111
+ */
112
+ h_flip?: boolean;
113
+ /**
114
+ * vertical flip
115
+ */
116
+ v_flip?: boolean;
117
+ /**
118
+ * whether the tile is rotated 90 degrees clockwise
119
+ */
120
+ rotate_90?: boolean;
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ export {};
@@ -0,0 +1,38 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace zip {
7
+ namespace pack {
8
+ type entries = (string | zip.pack.entry)[];
9
+ type entry = { 1: string; 2?: string; method?: unknown; level?: number };
10
+ /**
11
+ * Options for zip.pack
12
+ */
13
+ interface options {
14
+ /**
15
+ * compression method, defaults to `zip.METHOD.DEFLATED`
16
+ */
17
+ method?: unknown;
18
+ /**
19
+ * compression level from 0 to 9 for deflated entries; defaults to 6
20
+ */
21
+ level?: number;
22
+ }
23
+ }
24
+ namespace unpack {
25
+ /**
26
+ * Options for zip.unpack
27
+ */
28
+ interface options {
29
+ /**
30
+ * conflict resolution strategy
31
+ */
32
+ on_conflict: unknown;
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ export {};
@@ -0,0 +1,24 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * Editor scripting documentation
5
+ */
6
+ namespace zlib {
7
+ /**
8
+ * Deflate (compress) a buffer
9
+ *
10
+ * @param buf - buffer to deflate
11
+ * @returns deflated buffer
12
+ */
13
+ function deflate(buf: string): string;
14
+ /**
15
+ * Inflate (decompress) a buffer
16
+ *
17
+ * @param buf - buffer to inflate
18
+ * @returns inflated buffer
19
+ */
20
+ function inflate(buf: string): string;
21
+ }
22
+ }
23
+
24
+ export {};