@defold-typescript/types 0.39.0 → 0.41.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 (227) hide show
  1. package/api-availability.json +4024 -716
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18118 -10264
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +619 -148
  6. package/fixtures/messages_doc.json +96 -0
  7. package/generated/b2d.d.ts +680 -4
  8. package/generated/b2d_body.d.ts +29 -103
  9. package/generated/b2d_chain.d.ts +5 -6
  10. package/generated/b2d_fixture.d.ts +34 -38
  11. package/generated/b2d_joint.d.ts +503 -25
  12. package/generated/b2d_shape.d.ts +199 -14
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +33 -29
  15. package/generated/builtin-messages.d.ts +7 -1
  16. package/generated/bullet3d.d.ts +91 -0
  17. package/generated/bullet3d_collision_object.d.ts +433 -0
  18. package/generated/bullet3d_constraint.d.ts +818 -0
  19. package/generated/bullet3d_rigid_body.d.ts +429 -0
  20. package/generated/bullet3d_shape.d.ts +123 -0
  21. package/generated/bullet3d_world.d.ts +492 -0
  22. package/generated/camera.d.ts +31 -34
  23. package/generated/collectionfactory.d.ts +26 -27
  24. package/generated/collectionproxy.d.ts +22 -6
  25. package/generated/compute.d.ts +12 -238
  26. package/generated/crash.d.ts +24 -10
  27. package/generated/editor-vm/http.d.ts +90 -7
  28. package/generated/editor-vm/image.d.ts +7 -7
  29. package/generated/editor-vm/json.d.ts +11 -0
  30. package/generated/editor-vm/localization.d.ts +7 -7
  31. package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
  32. package/generated/editor-vm/zip.d.ts +28 -0
  33. package/generated/editor.d.ts +1496 -430
  34. package/generated/factory.d.ts +21 -25
  35. package/generated/font.d.ts +64 -22
  36. package/generated/go.d.ts +243 -186
  37. package/generated/graphics.d.ts +374 -84
  38. package/generated/gui.d.ts +282 -492
  39. package/generated/html5.d.ts +5 -3
  40. package/generated/http.d.ts +31 -36
  41. package/generated/image.d.ts +127 -85
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +8 -0
  44. package/generated/kinds/render-script.d.ts +8 -0
  45. package/generated/kinds/script.d.ts +8 -0
  46. package/generated/label.d.ts +77 -7
  47. package/generated/liveupdate.d.ts +13 -10
  48. package/generated/material.d.ts +312 -360
  49. package/generated/model.d.ts +72 -42
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +378 -144
  52. package/generated/profiler.d.ts +14 -24
  53. package/generated/render.d.ts +294 -297
  54. package/generated/resource.d.ts +753 -641
  55. package/generated/socket.d.ts +131 -134
  56. package/generated/sound.d.ts +65 -34
  57. package/generated/sprite.d.ts +39 -17
  58. package/generated/sys.d.ts +237 -182
  59. package/generated/tilemap.d.ts +21 -16
  60. package/generated/timer.d.ts +34 -21
  61. package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
  62. package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
  63. package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
  65. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
  66. package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
  67. package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
  68. package/generated/versions/defold-1.12.4/go.d.ts +15 -17
  69. package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
  70. package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
  71. package/generated/versions/defold-1.12.4/http.d.ts +4 -15
  72. package/generated/versions/defold-1.12.4/image.d.ts +38 -46
  73. package/generated/versions/defold-1.12.4/index.d.ts +2 -0
  74. package/generated/versions/defold-1.12.4/json.d.ts +10 -6
  75. package/generated/versions/defold-1.12.4/label.d.ts +2 -3
  76. package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
  77. package/generated/versions/defold-1.12.4/model.d.ts +34 -13
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
  81. package/generated/versions/defold-1.12.4/render.d.ts +160 -132
  82. package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
  83. package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
  84. package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
  86. package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
  87. package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
  88. package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
  89. package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
  90. package/generated/versions/defold-1.12.4/window.d.ts +1 -16
  91. package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
  92. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
  93. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
  94. package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
  95. package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
  96. package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
  100. package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
  101. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
  102. package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
  103. package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
  104. package/generated/versions/defold-1.13.0/go.d.ts +15 -17
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
  107. package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
  108. package/generated/versions/defold-1.13.0/http.d.ts +4 -15
  109. package/generated/versions/defold-1.13.0/image.d.ts +38 -46
  110. package/generated/versions/defold-1.13.0/index.d.ts +2 -0
  111. package/generated/versions/defold-1.13.0/json.d.ts +10 -6
  112. package/generated/versions/defold-1.13.0/label.d.ts +2 -3
  113. package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
  114. package/generated/versions/defold-1.13.0/material.d.ts +69 -107
  115. package/generated/versions/defold-1.13.0/model.d.ts +34 -13
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
  119. package/generated/versions/defold-1.13.0/render.d.ts +160 -132
  120. package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
  121. package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
  122. package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
  124. package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
  125. package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
  126. package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
  127. package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
  128. package/generated/versions/defold-1.13.0/window.d.ts +1 -16
  129. package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
  130. package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
  131. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
  132. package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
  133. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
  134. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
  135. package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
  136. package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
  137. package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
  138. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
  139. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
  140. package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
  141. package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
  142. package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
  143. package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
  144. package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
  145. package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
  146. package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
  147. package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
  148. package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
  149. package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
  150. package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
  151. package/generated/versions/defold-1.13.1/font.d.ts +81 -0
  152. package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
  153. package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
  154. package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
  155. package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
  156. package/generated/versions/defold-1.13.1/http.d.ts +77 -0
  157. package/generated/versions/defold-1.13.1/image.d.ts +131 -0
  158. package/generated/versions/defold-1.13.1/index.d.ts +57 -0
  159. package/generated/versions/defold-1.13.1/json.d.ts +80 -0
  160. package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
  161. package/generated/versions/defold-1.13.1/label.d.ts +93 -0
  162. package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
  163. package/generated/versions/defold-1.13.1/material.d.ts +408 -0
  164. package/generated/versions/defold-1.13.1/model.d.ts +272 -0
  165. package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
  166. package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
  167. package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
  168. package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
  169. package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
  170. package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
  171. package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
  172. package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
  173. package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
  174. package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
  175. package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
  176. package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
  177. package/generated/versions/defold-1.13.1/types.d.ts +61 -0
  178. package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
  179. package/generated/versions/defold-1.13.1/window.d.ts +183 -0
  180. package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
  181. package/generated/vmath.d.ts +6 -26
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +8 -0
  185. package/package.json +13 -2
  186. package/scripts/example-store-io.ts +12 -1
  187. package/scripts/extension-goldens.ts +1 -0
  188. package/scripts/fidelity-baseline.json +146 -46
  189. package/scripts/generate-api-availability.ts +90 -12
  190. package/scripts/generate-api-signatures.ts +14 -3
  191. package/scripts/import-defold-release.ts +85 -24
  192. package/scripts/prose-constants.ts +157 -0
  193. package/scripts/regen.ts +396 -78
  194. package/scripts/shared-handle-methods.ts +53 -0
  195. package/scripts/signature-store-fs.ts +1 -0
  196. package/scripts/sync-api-docs.ts +16 -5
  197. package/src/api-availability.ts +0 -0
  198. package/src/api-doc.ts +201 -3
  199. package/src/api-identity.ts +252 -0
  200. package/src/component-properties.d.ts +33 -0
  201. package/src/core-types.ts +28 -3
  202. package/src/correction-pins.ts +49 -0
  203. package/src/custom-messages.d.ts +4 -3
  204. package/src/doc-comment.ts +139 -23
  205. package/src/doc-corrections.ts +108 -0
  206. package/src/editor-vm-globals.d.ts +5 -2
  207. package/src/emit-dts.ts +2474 -281
  208. package/src/emit-messages.ts +52 -0
  209. package/src/engine-globals.d.ts +2 -2
  210. package/src/example-store.ts +125 -14
  211. package/src/field-correction-coverage.ts +204 -0
  212. package/src/fnv1a.ts +16 -0
  213. package/src/go-overloads.d.ts +33 -13
  214. package/src/index-base-table.ts +145 -0
  215. package/src/index-slot-classifications.ts +588 -0
  216. package/src/index.ts +39 -2
  217. package/src/library-index-slot-classifications.ts +332 -0
  218. package/src/lifecycle.ts +61 -199
  219. package/src/luals-type-expr.ts +354 -0
  220. package/src/msg-overloads.d.ts +0 -1
  221. package/src/param-correction-provenance.ts +64 -0
  222. package/src/return-correction-provenance.ts +58 -16
  223. package/src/script-api.ts +3 -1
  224. package/src/sys-overloads.d.ts +48 -0
  225. package/src/vmath-overloads.d.ts +27 -1
  226. package/src/window-event-guard.d.ts +6 -9
  227. package/url-parameters.json +1 -2
@@ -1,5 +1,5 @@
1
1
  /** @noSelfInFile */
2
- import type { Hash, Matrix4, Vector3, Vector4 } from "../src/core-types";
2
+ import type { Hash } from "../src/core-types";
3
3
 
4
4
  declare global {
5
5
  /**
@@ -10,285 +10,59 @@ declare global {
10
10
  * Returns a table of all the shader constants in the compute program.
11
11
  *
12
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`.
13
+ * @returns Information about the shader constants.
56
14
  * @example
57
15
  * ```ts
58
16
  * const constants = compute.get_constants("/my_compute.computec");
59
17
  * ```
60
18
  */
61
- function get_constants(path: Hash | string): { name: Hash; type: number; value: Vector4 | Matrix4 }[];
19
+ function get_constants(path: Hash | string): material.constant_info[];
62
20
  /**
63
21
  * Returns a table of all the texture samplers in the compute program. This function will return all the texture samplers
64
22
  * that are available, even the ones that have not been specified in the compute resource.
65
23
  *
66
24
  * @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
25
+ * @returns Information about the texture samplers.
121
26
  * @example
122
27
  * ```ts
123
28
  * const samplers = compute.get_samplers("/my_compute.computec");
124
29
  * ```
125
30
  */
126
- function get_samplers(path: Hash | string): { name: Hash; u_wrap: number; v_wrap: number; min_filter: number; mag_filter: number; max_anisotropy: number }[];
31
+ function get_samplers(path: Hash | string): material.sampler_info[];
127
32
  /**
128
33
  * Returns a table of all the textures from the compute program.
129
34
  *
130
35
  * @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`
36
+ * @returns Information about the compute textures.
172
37
  * @example
173
38
  * ```ts
174
39
  * const textures = compute.get_textures("/my_compute.computec");
175
40
  * ```
176
41
  */
177
- function get_textures(path: Hash | string): { path: Hash; handle: Hash; width: number; height: number; depth: number; mipmaps: number; type: number; flags: number }[];
42
+ function get_textures(path: Hash | string): material.texture_info[];
178
43
  /**
179
44
  * Sets shader constants in a compute program, if the constants exist.
180
45
  *
181
46
  * @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.
47
+ * @param constants - Constant options keyed by constant name. Partial updates are supported.
223
48
  * @example
224
49
  * ```ts
225
50
  * compute.set_constants("/my_compute.computec", { tint: { value: vmath.vector4(1, 0, 0, 1) } });
226
51
  * ```
227
52
  */
228
- function set_constants(path: Hash | string, constants: Record<string, { type?: number; value?: Vector4 | Vector3 | Matrix4 | number | (Vector4 | Matrix4)[] }>): void;
53
+ function set_constants(path: Hash | string, constants: LuaMap<string | Hash, material.constant_options> | Record<string, material.constant_options>): void;
229
54
  /**
230
55
  * Sets texture samplers in a compute program, if the samplers exist. Use this function to change the settings of texture samplers.
231
56
  * To set actual textures that should be bound to the samplers, use the `compute.set_textures` function instead.
232
57
  *
233
58
  * @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
59
+ * @param samplers - Sampler options keyed by sampler name. Partial updates are supported.
286
60
  * @example
287
61
  * ```ts
288
62
  * compute.set_samplers("/my_compute.computec", { texture_sampler: { u_wrap: graphics.TEXTURE_WRAP_REPEAT, v_wrap: graphics.TEXTURE_WRAP_MIRRORED_REPEAT } });
289
63
  * ```
290
64
  */
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;
65
+ function set_samplers(path: Hash | string, samplers: LuaMap<string | Hash, material.sampler_options> | Record<string, material.sampler_options>): void;
292
66
  /**
293
67
  * Sets textures in a compute program, if the samplers exist.
294
68
  *
@@ -299,7 +73,7 @@ declare global {
299
73
  * compute.set_textures("/my_compute.computec", { my_texture: resource.texture() });
300
74
  * ```
301
75
  */
302
- function set_textures(path: Hash | string, textures: LuaMap<string, Hash>): void;
76
+ function set_textures(path: Hash | string, textures: LuaMap<string | Hash, string | Hash> | Record<string, string | Hash>): void;
303
77
  }
304
78
  }
305
79
 
@@ -4,6 +4,21 @@ declare global {
4
4
  * Native crash logging functions and constants.
5
5
  */
6
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;
7
22
  /**
8
23
  * android build fingerprint
9
24
  */
@@ -62,7 +77,7 @@ declare global {
62
77
  * @param handle - crash dump handle
63
78
  * @returns table containing the backtrace
64
79
  */
65
- function get_backtrace(handle: number): Record<string | number, unknown>;
80
+ function get_backtrace(handle: number): string[];
66
81
  /**
67
82
  * The format of read text blob is platform specific
68
83
  * and not guaranteed
@@ -73,13 +88,12 @@ declare global {
73
88
  */
74
89
  function get_extra_data(handle: number): string;
75
90
  /**
76
- * The function returns a table containing entries with sub-tables that
77
- * have fields 'name' and 'address' set for all loaded modules.
91
+ * get all loaded modules from when the crash occured
78
92
  *
79
93
  * @param handle - crash dump handle
80
- * @returns module table
94
+ * @returns loaded modules
81
95
  */
82
- function get_modules(handle: number): Record<string | number, unknown>;
96
+ function get_modules(handle: number): crash.module_info[];
83
97
  /**
84
98
  * read signal number from a crash report
85
99
  *
@@ -94,15 +108,15 @@ declare global {
94
108
  * @param index - system field enum. Must be less than crash.SYSFIELD_MAX
95
109
  * @returns value recorded in the crash dump, or `nil` if it didn't exist
96
110
  */
97
- function get_sys_field(handle: number, index: number): string | undefined;
111
+ function get_sys_field(handle: number, index: crash.SYSFIELD): string | undefined;
98
112
  /**
99
113
  * reads user field from a loaded crash dump
100
114
  *
101
115
  * @param handle - crash dump handle
102
- * @param index - user data slot index
116
+ * @param index - user data slot index. **0️⃣ 0-based; passed to Defold unchanged.**
103
117
  * @returns user data value recorded in the crash dump
104
118
  */
105
- function get_user_field(handle: number, index: number): string;
119
+ function get_user_field(handle: number, index: crash.USERFIELD): string;
106
120
  /**
107
121
  * The crash dump will be removed from disk upon a successful
108
122
  * load, so loading is one-shot.
@@ -127,10 +141,10 @@ declare global {
127
141
  * a crash occurs. This can be user id:s, breadcrumb data etc.
128
142
  * There are 32 slots indexed from 0. Each slot stores at most 255 characters.
129
143
  *
130
- * @param index - slot index. 0-indexed
144
+ * @param index - slot index. 0-indexed. **0️⃣ 0-based; passed to Defold unchanged.**
131
145
  * @param value - string value to store
132
146
  */
133
- function set_user_field(index: number, value: string): void;
147
+ function set_user_field(index: crash.USERFIELD, value: string): void;
134
148
  /**
135
149
  * Performs the same steps as if a crash had just occured but
136
150
  * allows the program to continue.
@@ -1,18 +1,101 @@
1
1
  /** @noSelfInFile */
2
+ import type { Opaque } from "../../src/core-types";
3
+
2
4
  declare global {
3
5
  /**
4
6
  * Editor scripting documentation
5
7
  */
6
8
  namespace http {
9
+ type response = Opaque<"http.response">;
10
+ type route = Opaque<"http.route">;
7
11
  /**
8
12
  * Perform an HTTP request
9
13
  *
10
14
  * @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"`; mutually exclusive with `path``path string`destination file path, resolved against project root if relative; mutually exclusive with `as`
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`path string, nil`resolved absolute destination path, present only after a successful response was written when the `path` option was provided
15
+ * @param opts - request options
16
+ * @returns HTTP response
13
17
  */
14
- function request(url: string, opts?: Record<string | number, unknown>): Record<string | number, unknown>;
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
+ }
15
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
+ }
16
99
  /**
17
100
  * Create HTTP response that will stream the content of a file defined by the path
18
101
  *
@@ -21,7 +104,7 @@ declare global {
21
104
  * @param headers - HTTP response headers, a table from lower-case header names to header values
22
105
  * @returns HTTP response value, userdata
23
106
  */
24
- function external_file_response(path: string, status?: number, headers?: unknown): unknown;
107
+ function external_file_response(path: string, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
25
108
  /**
26
109
  * Create HTTP response with a JSON value
27
110
  *
@@ -30,7 +113,7 @@ declare global {
30
113
  * @param headers - HTTP response headers, a table from lower-case header names to header values
31
114
  * @returns HTTP response value, userdata
32
115
  */
33
- function json_response(value: unknown, status?: number, headers?: unknown): unknown;
116
+ function json_response(value: unknown, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
34
117
  /**
35
118
  * Create HTTP response that will stream the content of a resource defined by the resource path
36
119
  *
@@ -39,7 +122,7 @@ declare global {
39
122
  * @param headers - HTTP response headers, a table from lower-case header names to header values
40
123
  * @returns HTTP response value, userdata
41
124
  */
42
- function resource_response(resource_path: string, status?: number, headers?: unknown): unknown;
125
+ function resource_response(resource_path: string, status?: number, headers?: LuaMap<string, string> | Record<string, string>): http.response;
43
126
  /**
44
127
  * Create HTTP response
45
128
  *
@@ -48,7 +131,7 @@ declare global {
48
131
  * @param body - HTTP response body
49
132
  * @returns HTTP response value, userdata
50
133
  */
51
- function response(status?: number, headers?: unknown, body?: string): unknown;
134
+ function response(status?: number, headers?: LuaMap<string, string> | Record<string, string>, body?: string): http.response;
52
135
  }
53
136
  }
54
137
  }
@@ -10,22 +10,22 @@ declare global {
10
10
  * @param path - External file path, resolved against project root if relative
11
11
  * @returns image userdata
12
12
  */
13
- function load_file(path: string): unknown;
13
+ function load_file(path: string): editor.image;
14
14
  /**
15
15
  * Return the color of a pixel from a loaded image.
16
16
  * Coordinates are 1-based, with `1, 1` at the top-left corner.
17
17
  *
18
18
  * @param image - image userdata returned by `image.load_file()`
19
- * @param x - 1-based horizontal pixel coordinate
20
- * @param y - 1-based vertical pixel coordinate
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
21
  */
22
- function pixel(image: unknown, x: number, y: number): LuaMultiReturn<[number, number, number, number]>;
22
+ function pixel(image: editor.image, x: number, y: number): LuaMultiReturn<[number, number, number, number]>;
23
23
  /**
24
24
  * Iterate over pixels in a loaded image.
25
25
  * The iterator returns pixels row by row from top-left to bottom-right. Coordinates are 1-based.
26
26
  *
27
27
  * @param image - image userdata returned by `image.load_file()`
28
- * @returns iterator function returning `x, y, r, g, b, a` for each pixel
28
+ * @returns iterator function returning `x, y, r, g, b, a` for each pixel. **⚠️ 1-based; passed to Defold unchanged.**
29
29
  * @example
30
30
  * ```lua
31
31
  * local img = image.load_file("assets/source.png")
@@ -35,13 +35,13 @@ declare global {
35
35
  * end
36
36
  * ```
37
37
  */
38
- function pixels(image: unknown): (...args: unknown[]) => unknown;
38
+ function pixels(image: editor.image): (...args: unknown[]) => unknown;
39
39
  /**
40
40
  * Return the width and height of a loaded image.
41
41
  *
42
42
  * @param image - image userdata returned by `image.load_file()`
43
43
  */
44
- function size(image: unknown): LuaMultiReturn<[number, number]>;
44
+ function size(image: editor.image): LuaMultiReturn<[number, number]>;
45
45
  }
46
46
  }
47
47
 
@@ -4,6 +4,17 @@ declare global {
4
4
  * Editor scripting documentation
5
5
  */
6
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
+ }
7
18
  }
8
19
  }
9
20
 
@@ -9,18 +9,18 @@ declare global {
9
9
  /**
10
10
  * Create a message pattern that renders a list with the "and" conjunction (for example: a, b, and c) once it is stringified
11
11
  *
12
- * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
12
+ * @param items - array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
13
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
14
  */
15
- function and_list(items: unknown[]): Opaque<"message">;
15
+ function and_list(items: (undefined | boolean | number | string | Opaque<"message">)[]): Opaque<"message">;
16
16
  /**
17
17
  * Create a message pattern that concatenates values (similar to `table.concat`) and performs the actual concatenation when stringified
18
18
  *
19
- * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
19
+ * @param items - array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
20
20
  * @param separator - optional separator inserted between values; defaults to an empty string
21
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
22
  */
23
- function concat(items: unknown[], separator?: boolean | number | string | Opaque<"message">): Opaque<"message">;
23
+ function concat(items: (undefined | boolean | number | string | Opaque<"message">)[], separator?: boolean | number | string | Opaque<"message">): Opaque<"message">;
24
24
  /**
25
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
26
  *
@@ -28,14 +28,14 @@ declare global {
28
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
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
30
  */
31
- function message(key: string, vars?: Record<string | number, unknown>): Opaque<"message">;
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
32
  /**
33
33
  * Create a message pattern that renders a list with the "or" conjunction (for example: a, b, or c) once it is stringified
34
34
  *
35
- * @param items - ] array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
35
+ * @param items - array of values; each value may be `nil`, `boolean`, `number`, `string`, or another `message` instance
36
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
37
  */
38
- function or_list(items: unknown[]): Opaque<"message">;
38
+ function or_list(items: (undefined | boolean | number | string | Opaque<"message">)[]): Opaque<"message">;
39
39
  }
40
40
  }
41
41