@defold-typescript/types 0.50.1 → 0.52.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 (166) hide show
  1. package/api-availability.json +4 -58
  2. package/api-signatures.json +1128 -1552
  3. package/api-targets.json +15 -5
  4. package/examples/translations.json +19 -71
  5. package/fixtures/messages_doc.json +20 -39
  6. package/generated/b2d_world.d.ts +10 -10
  7. package/generated/buffer.d.ts +9 -9
  8. package/generated/builtin-messages.d.ts +16 -14
  9. package/generated/bullet3d_collision_object.d.ts +1 -1
  10. package/generated/bullet3d_constraint.d.ts +109 -7
  11. package/generated/bullet3d_shape.d.ts +2 -2
  12. package/generated/collectionfactory.d.ts +1 -1
  13. package/generated/collectionproxy.d.ts +2 -2
  14. package/generated/factory.d.ts +4 -2
  15. package/generated/go.d.ts +114 -220
  16. package/generated/graphics.d.ts +5 -0
  17. package/generated/gui.d.ts +148 -371
  18. package/generated/http.d.ts +4 -2
  19. package/generated/image.d.ts +56 -4
  20. package/generated/kinds/gui-script.d.ts +3 -0
  21. package/generated/kinds/render-script.d.ts +15 -15
  22. package/generated/kinds/script.d.ts +1 -0
  23. package/generated/liveupdate.d.ts +5 -1
  24. package/generated/material.d.ts +3 -3
  25. package/generated/model.d.ts +4 -5
  26. package/generated/particlefx.d.ts +20 -1
  27. package/generated/physics.d.ts +48 -4
  28. package/generated/render-script-modules/b2d.d.ts +711 -0
  29. package/generated/render-script-modules/bullet3d.d.ts +73 -0
  30. package/generated/render-script-modules/collectionfactory.d.ts +25 -0
  31. package/generated/render-script-modules/collectionproxy.d.ts +39 -0
  32. package/generated/render-script-modules/factory.d.ts +25 -0
  33. package/generated/render-script-modules/go.d.ts +436 -0
  34. package/generated/render-script-modules/label.d.ts +105 -0
  35. package/generated/render-script-modules/model.d.ts +89 -0
  36. package/generated/render-script-modules/particlefx.d.ts +59 -0
  37. package/generated/render-script-modules/physics.d.ts +333 -0
  38. package/generated/render-script-modules/resource.d.ts +1233 -0
  39. package/generated/render-script-modules/sound.d.ts +227 -0
  40. package/generated/render-script-modules/sprite.d.ts +68 -0
  41. package/generated/render-script-modules/tilemap.d.ts +43 -0
  42. package/generated/render.d.ts +175 -21
  43. package/generated/resource.d.ts +31 -10
  44. package/generated/sprite.d.ts +49 -1
  45. package/generated/sys.d.ts +78 -10
  46. package/generated/tilemap.d.ts +4 -4
  47. package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
  48. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +1 -1
  49. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
  50. package/generated/versions/defold-1.12.4/factory.d.ts +4 -2
  51. package/generated/versions/defold-1.12.4/go.d.ts +115 -343
  52. package/generated/versions/defold-1.12.4/graphics.d.ts +1 -0
  53. package/generated/versions/defold-1.12.4/gui.d.ts +151 -513
  54. package/generated/versions/defold-1.12.4/http.d.ts +4 -2
  55. package/generated/versions/defold-1.12.4/image.d.ts +83 -3
  56. package/generated/versions/defold-1.12.4/index.d.ts +2 -0
  57. package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
  58. package/generated/versions/defold-1.12.4/model.d.ts +4 -5
  59. package/generated/versions/defold-1.12.4/particlefx.d.ts +22 -1
  60. package/generated/versions/defold-1.12.4/physics.d.ts +47 -3
  61. package/generated/versions/defold-1.12.4/render.d.ts +119 -15
  62. package/generated/versions/defold-1.12.4/resource.d.ts +43 -10
  63. package/generated/versions/defold-1.12.4/sprite.d.ts +58 -1
  64. package/generated/versions/defold-1.12.4/sys.d.ts +101 -6
  65. package/generated/versions/defold-1.12.4/tilemap.d.ts +4 -4
  66. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
  67. package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
  68. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +1 -1
  69. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
  70. package/generated/versions/defold-1.13.0/factory.d.ts +4 -2
  71. package/generated/versions/defold-1.13.0/go.d.ts +115 -370
  72. package/generated/versions/defold-1.13.0/graphics.d.ts +1 -0
  73. package/generated/versions/defold-1.13.0/gui.d.ts +151 -513
  74. package/generated/versions/defold-1.13.0/http.d.ts +4 -2
  75. package/generated/versions/defold-1.13.0/image.d.ts +83 -3
  76. package/generated/versions/defold-1.13.0/index.d.ts +2 -0
  77. package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
  78. package/generated/versions/defold-1.13.0/material.d.ts +3 -1
  79. package/generated/versions/defold-1.13.0/model.d.ts +4 -5
  80. package/generated/versions/defold-1.13.0/particlefx.d.ts +22 -1
  81. package/generated/versions/defold-1.13.0/physics.d.ts +47 -3
  82. package/generated/versions/defold-1.13.0/render.d.ts +182 -16
  83. package/generated/versions/defold-1.13.0/resource.d.ts +43 -10
  84. package/generated/versions/defold-1.13.0/sprite.d.ts +58 -1
  85. package/generated/versions/defold-1.13.0/sys.d.ts +101 -6
  86. package/generated/versions/defold-1.13.0/tilemap.d.ts +4 -4
  87. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
  88. package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
  89. package/generated/versions/defold-1.13.1/collectionfactory.d.ts +1 -1
  90. package/generated/versions/defold-1.13.1/collectionproxy.d.ts +1 -1
  91. package/generated/versions/defold-1.13.1/factory.d.ts +4 -2
  92. package/generated/versions/defold-1.13.1/go.d.ts +115 -370
  93. package/generated/versions/defold-1.13.1/graphics.d.ts +1 -0
  94. package/generated/versions/defold-1.13.1/gui.d.ts +151 -529
  95. package/generated/versions/defold-1.13.1/http.d.ts +4 -2
  96. package/generated/versions/defold-1.13.1/image.d.ts +83 -3
  97. package/generated/versions/defold-1.13.1/index.d.ts +3 -0
  98. package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
  99. package/generated/versions/defold-1.13.1/material.d.ts +3 -1
  100. package/generated/versions/defold-1.13.1/model.d.ts +4 -5
  101. package/generated/versions/defold-1.13.1/particlefx.d.ts +22 -1
  102. package/generated/versions/defold-1.13.1/physics.d.ts +47 -3
  103. package/generated/versions/defold-1.13.1/render.d.ts +182 -16
  104. package/generated/versions/defold-1.13.1/resource.d.ts +43 -10
  105. package/generated/versions/defold-1.13.1/sprite.d.ts +58 -1
  106. package/generated/versions/defold-1.13.1/sys.d.ts +101 -6
  107. package/generated/versions/defold-1.13.1/tilemap.d.ts +4 -4
  108. package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
  109. package/generated/versions/defold-1.13.2/b2d_world.d.ts +10 -10
  110. package/generated/versions/defold-1.13.2/buffer.d.ts +9 -9
  111. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +1 -1
  112. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +109 -7
  113. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +2 -2
  114. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +1 -1
  115. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +2 -2
  116. package/generated/versions/defold-1.13.2/factory.d.ts +4 -2
  117. package/generated/versions/defold-1.13.2/go.d.ts +114 -220
  118. package/generated/versions/defold-1.13.2/graphics.d.ts +1 -0
  119. package/generated/versions/defold-1.13.2/gui.d.ts +148 -371
  120. package/generated/versions/defold-1.13.2/http.d.ts +4 -2
  121. package/generated/versions/defold-1.13.2/image.d.ts +56 -4
  122. package/generated/versions/defold-1.13.2/index.d.ts +3 -0
  123. package/generated/versions/defold-1.13.2/liveupdate.d.ts +5 -1
  124. package/generated/versions/defold-1.13.2/material.d.ts +3 -3
  125. package/generated/versions/defold-1.13.2/model.d.ts +4 -5
  126. package/generated/versions/defold-1.13.2/particlefx.d.ts +20 -1
  127. package/generated/versions/defold-1.13.2/physics.d.ts +48 -4
  128. package/generated/versions/defold-1.13.2/render.d.ts +164 -20
  129. package/generated/versions/defold-1.13.2/resource.d.ts +31 -10
  130. package/generated/versions/defold-1.13.2/sprite.d.ts +49 -1
  131. package/generated/versions/defold-1.13.2/sys.d.ts +78 -10
  132. package/generated/versions/defold-1.13.2/tilemap.d.ts +4 -4
  133. package/generated/versions/defold-1.13.2/vmath.d.ts +0 -24
  134. package/generated/versions/defold-1.13.2/window.d.ts +1 -1
  135. package/generated/vmath.d.ts +0 -24
  136. package/generated/window.d.ts +1 -1
  137. package/identity-vocabulary.json +98 -7
  138. package/index.d.ts +3 -0
  139. package/package.json +3 -1
  140. package/scripts/generate-api-availability.ts +6 -22
  141. package/scripts/generate-api-signatures.ts +87 -21
  142. package/scripts/materialize-version.ts +53 -6
  143. package/scripts/regen.ts +256 -44
  144. package/scripts/signature-store-fs.ts +1 -0
  145. package/scripts/target-version.ts +26 -0
  146. package/src/api-doc.ts +26 -0
  147. package/src/component-properties.d.ts +226 -6
  148. package/src/core-types.ts +82 -20
  149. package/src/doc-corrections.ts +53 -5
  150. package/src/emit-dts.ts +1300 -269
  151. package/src/emit-messages.ts +289 -0
  152. package/src/engine-globals.d.ts +8 -2
  153. package/src/go-overloads.d.ts +80 -15
  154. package/src/gui-overloads.d.ts +489 -0
  155. package/src/gui-texture-removal.d.ts +41 -0
  156. package/src/index.ts +2 -0
  157. package/src/lifecycle.ts +46 -37
  158. package/src/luals-type-expr.ts +6 -1
  159. package/src/msg-overloads.d.ts +25 -13
  160. package/src/physics-event-guard.d.ts +39 -0
  161. package/src/render-overloads.d.ts +2 -2
  162. package/src/return-correction-provenance.ts +36 -6
  163. package/src/signature-store.ts +50 -0
  164. package/src/timers.d.ts +2 -1
  165. package/src/vmath-overloads.d.ts +26 -0
  166. package/src/window-event-guard.d.ts +5 -3
@@ -1,24 +1,210 @@
1
1
  /** @noSelfInFile */
2
2
 
3
- import type { Hash } from "./core-types";
3
+ import type { Hash, Vector3 } from "./core-types";
4
4
 
5
- // Component property keys upstream examples read through `go.get` while no
6
- // ref-doc catalog declares them. Only evidenced keys belong here.
5
+ // Property keys the engine handles while no ref-doc catalog declares them. Each
6
+ // key comes from the component's `GetProperty` / `SetProperty` branches in the
7
+ // engine source, or from an upstream example that reads it, and cites that
8
+ // evidence. A key the engine reads but never writes is `readonly`.
7
9
  declare global {
10
+ namespace go {
11
+ interface properties {
12
+ /** The position's x component. `gameobject.cpp:GetProperty` reads one float. */
13
+ "position.x": number;
14
+ /** The position's y component. `gameobject.cpp:GetProperty` reads one float. */
15
+ "position.y": number;
16
+ /** The position's z component. `gameobject.cpp:GetProperty` reads one float. */
17
+ "position.z": number;
18
+ /** The rotation quaternion's x component. `gameobject.cpp:GetProperty` reads one float. */
19
+ "rotation.x": number;
20
+ /** The rotation quaternion's y component. `gameobject.cpp:GetProperty` reads one float. */
21
+ "rotation.y": number;
22
+ /** The rotation quaternion's z component. `gameobject.cpp:GetProperty` reads one float. */
23
+ "rotation.z": number;
24
+ /** The rotation quaternion's w component. `gameobject.cpp:GetProperty` reads one float. */
25
+ "rotation.w": number;
26
+ /** The euler rotation's x angle, in degrees. `gameobject.cpp:GetProperty` reads one float. */
27
+ "euler.x": number;
28
+ /** The euler rotation's y angle, in degrees. `gameobject.cpp:GetProperty` reads one float. */
29
+ "euler.y": number;
30
+ /** The euler rotation's z angle, in degrees. `gameobject.cpp:GetProperty` reads one float. */
31
+ "euler.z": number;
32
+ /** The scale's x component. `gameobject.cpp:GetProperty` reads one float. */
33
+ "scale.x": number;
34
+ /** The scale's y component. `gameobject.cpp:GetProperty` reads one float. */
35
+ "scale.y": number;
36
+ /** The scale's z component. `gameobject.cpp:GetProperty` reads one float. */
37
+ "scale.z": number;
38
+ /**
39
+ * The scale's x and y components. `gameobject.cpp:GetProperty` reads a
40
+ * vector3 whose z is always 1. `go.set` also takes a number, which it
41
+ * applies to both x and y.
42
+ */
43
+ "scale.xy": Vector3;
44
+ }
45
+ }
46
+
47
+ namespace label {
48
+ interface properties {
49
+ /** The scale's x component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
50
+ "scale.x": number;
51
+ /** The scale's y component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
52
+ "scale.y": number;
53
+ /** The scale's z component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
54
+ "scale.z": number;
55
+ /**
56
+ * The scale's x and y components. `comp_label.cpp` reads it through
57
+ * `comp_private.cpp:GetProperty`, which returns the whole vector3. `go.set`
58
+ * also takes a number, which it applies to both x and y, as `go`'s
59
+ * `"scale.xy"` does.
60
+ */
61
+ "scale.xy": Vector3;
62
+ /** The size's x component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
63
+ "size.x": number;
64
+ /** The size's y component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
65
+ "size.y": number;
66
+ /** The size's z component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
67
+ "size.z": number;
68
+ /**
69
+ * The size's x and y components. `comp_label.cpp` reads it through
70
+ * `comp_private.cpp:GetProperty`, which returns the whole vector3. `go.set`
71
+ * also takes a number, which it applies to both x and y, as `go`'s
72
+ * `"scale.xy"` does.
73
+ */
74
+ "size.xy": Vector3;
75
+ /** The color's x component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
76
+ "color.x": number;
77
+ /** The color's y component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
78
+ "color.y": number;
79
+ /** The color's z component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
80
+ "color.z": number;
81
+ /** The color's w component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
82
+ "color.w": number;
83
+ /** The outline color's x component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
84
+ "outline.x": number;
85
+ /** The outline color's y component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
86
+ "outline.y": number;
87
+ /** The outline color's z component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
88
+ "outline.z": number;
89
+ /** The outline color's w component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
90
+ "outline.w": number;
91
+ /** The shadow color's x component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
92
+ "shadow.x": number;
93
+ /** The shadow color's y component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
94
+ "shadow.y": number;
95
+ /** The shadow color's z component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
96
+ "shadow.z": number;
97
+ /** The shadow color's w component. `comp_label.cpp` and `comp_private.cpp` read and write one float. */
98
+ "shadow.w": number;
99
+ }
100
+ }
101
+
8
102
  namespace sprite {
9
103
  interface properties {
104
+ /** The scale's x component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
105
+ "scale.x": number;
106
+ /** The scale's y component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
107
+ "scale.y": number;
108
+ /** The scale's z component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
109
+ "scale.z": number;
110
+ /**
111
+ * The scale's x and y components. `comp_sprite.cpp` reads it through
112
+ * `comp_private.cpp:GetProperty`, which returns the whole vector3. `go.set`
113
+ * also takes a number, which it applies to both x and y, as `go`'s
114
+ * `"scale.xy"` does.
115
+ */
116
+ "scale.xy": Vector3;
117
+ /** The size's x component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
118
+ "size.x": number;
119
+ /** The size's y component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
120
+ "size.y": number;
121
+ /** The size's z component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
122
+ "size.z": number;
123
+ /**
124
+ * The size's x and y components. `comp_sprite.cpp` reads it through
125
+ * `comp_private.cpp:GetProperty`, which returns the whole vector3. `go.set`
126
+ * also takes a number, which it applies to both x and y, as `go`'s
127
+ * `"scale.xy"` does.
128
+ */
129
+ "size.xy": Vector3;
130
+ /** The slice-9 border's x component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
131
+ "slice.x": number;
132
+ /** The slice-9 border's y component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
133
+ "slice.y": number;
134
+ /** The slice-9 border's z component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
135
+ "slice.z": number;
136
+ /** The slice-9 border's w component. `comp_sprite.cpp` and `comp_private.cpp` read and write one float. */
137
+ "slice.w": number;
10
138
  /**
11
139
  * The texture bound to the sprite's first sampler. Not in the sprite
12
140
  * ref-doc; `resource.set`'s example reads it with
13
- * `go.get("#sprite", "texture0")`.
141
+ * `go.get("#sprite", "texture0")`. Read-only:
142
+ * `comp_sprite.cpp:CompSpriteSetProperty` has no branch for it.
14
143
  */
15
- texture0: Hash;
144
+ readonly texture0: Hash;
145
+ }
146
+ }
147
+
148
+ namespace model {
149
+ interface properties {
150
+ /**
151
+ * The material resource the model renders with.
152
+ * `comp_model.cpp:CompModelGetProperty` and `CompModelSetProperty` read
153
+ * and write it as a resource path hash.
154
+ */
155
+ material: Hash;
156
+ /**
157
+ * The skin the model's rig uses. `comp_model.cpp:CompModelGetProperty` and
158
+ * `CompModelSetProperty` read and write it as a hash.
159
+ */
160
+ skin: Hash;
161
+ }
162
+ }
163
+
164
+ namespace physics {
165
+ interface properties {
166
+ /**
167
+ * Whether the body runs continuous collision detection as a fast-moving
168
+ * bullet. Box2D only: `comp_collision_object_box2d.cpp` reads and writes
169
+ * it, while Bullet3D logs a warning and reports the property as not found.
170
+ */
171
+ bullet: boolean;
172
+ }
173
+ }
174
+
175
+ namespace factory {
176
+ /**
177
+ * Factory component properties. Upstream's factory reference declares none.
178
+ */
179
+ interface properties {
180
+ /**
181
+ * The path hash of the prototype the factory spawns. Read-only:
182
+ * `comp_factory.cpp:CompFactoryGetProperty` reads it and the component
183
+ * registers no set handler.
184
+ */
185
+ readonly prototype: Hash;
186
+ }
187
+ }
188
+
189
+ namespace collectionfactory {
190
+ /**
191
+ * Collection factory component properties. Upstream's collectionfactory
192
+ * reference declares none.
193
+ */
194
+ interface properties {
195
+ /**
196
+ * The path hash of the collection prototype the factory spawns.
197
+ * Read-only: `comp_collection_factory.cpp:CompCollectionFactoryGetProperty`
198
+ * reads it and the component registers no set handler.
199
+ */
200
+ readonly prototype: Hash;
16
201
  }
17
202
  }
18
203
 
19
204
  /**
20
205
  * Mesh component properties. Upstream ships no mesh API module, so this
21
- * catalog holds only the keys upstream examples read.
206
+ * catalog holds the keys `comp_mesh.cpp:CompMeshGetProperty` and
207
+ * `CompMeshSetProperty` handle.
22
208
  */
23
209
  namespace mesh {
24
210
  interface properties {
@@ -28,6 +214,40 @@ declare global {
28
214
  * `go.get("#mesh", "vertices")`.
29
215
  */
30
216
  vertices: Hash;
217
+ /** The material resource the mesh renders with, as a resource path hash. */
218
+ material: Hash;
219
+ /** The texture on unit 0, as a resource path hash. The engine holds units 0-15. */
220
+ texture0: Hash;
221
+ /** The texture on unit 1, as a resource path hash. */
222
+ texture1: Hash;
223
+ /** The texture on unit 2, as a resource path hash. */
224
+ texture2: Hash;
225
+ /** The texture on unit 3, as a resource path hash. */
226
+ texture3: Hash;
227
+ /** The texture on unit 4, as a resource path hash. */
228
+ texture4: Hash;
229
+ /** The texture on unit 5, as a resource path hash. */
230
+ texture5: Hash;
231
+ /** The texture on unit 6, as a resource path hash. */
232
+ texture6: Hash;
233
+ /** The texture on unit 7, as a resource path hash. */
234
+ texture7: Hash;
235
+ /** The texture on unit 8, as a resource path hash. */
236
+ texture8: Hash;
237
+ /** The texture on unit 9, as a resource path hash. */
238
+ texture9: Hash;
239
+ /** The texture on unit 10, as a resource path hash. */
240
+ texture10: Hash;
241
+ /** The texture on unit 11, as a resource path hash. */
242
+ texture11: Hash;
243
+ /** The texture on unit 12, as a resource path hash. */
244
+ texture12: Hash;
245
+ /** The texture on unit 13, as a resource path hash. */
246
+ texture13: Hash;
247
+ /** The texture on unit 14, as a resource path hash. */
248
+ texture14: Hash;
249
+ /** The texture on unit 15, as a resource path hash. */
250
+ texture15: Hash;
31
251
  }
32
252
  }
33
253
  }
package/src/core-types.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  /// <reference types="@typescript-to-lua/language-extensions" />
2
2
 
3
3
  /**
4
- * A read-only numeric vector accessed by index; `length` is its component count.
4
+ * A numeric vector of any size, accessed by index for reads and writes;
5
+ * `v.length()` is its component count.
6
+ *
7
+ * @remarks
8
+ * The index is 1-based and passed to Defold unchanged: `v[1]` is the first
9
+ * component, and an index outside `1..v.length()` raises. `v.length()` compiles
10
+ * to the Lua length operator `#v`; reading `v.length` as a field raises, since
11
+ * the engine accepts only integer keys.
5
12
  */
6
13
  export interface Vector {
7
- readonly [index: number]: number;
8
- readonly length: number;
14
+ [index: number]: number;
15
+ length: LuaLengthMethod<number>;
9
16
  }
10
17
 
11
18
  /**
@@ -80,11 +87,46 @@ export interface Matrix4 {
80
87
  m31: number;
81
88
  m32: number;
82
89
  m33: number;
83
- c0: Vector4;
84
- c1: Vector4;
85
- c2: Vector4;
86
- c3: Vector4;
87
- mul: LuaMultiplicationMethod<Matrix4, Matrix4> & LuaMultiplicationMethod<Vector4, Vector4>;
90
+ /**
91
+ * The first column. A read returns a new `Vector4`, so writing one of its
92
+ * fields changes nothing; assigning a whole `Vector4` sets the column.
93
+ */
94
+ get c0(): Readonly<Vector4>;
95
+ set c0(value: Vector4);
96
+ /**
97
+ * The second column. A read returns a new `Vector4`, so writing one of its
98
+ * fields changes nothing; assigning a whole `Vector4` sets the column.
99
+ */
100
+ get c1(): Readonly<Vector4>;
101
+ set c1(value: Vector4);
102
+ /**
103
+ * The third column. A read returns a new `Vector4`, so writing one of its
104
+ * fields changes nothing; assigning a whole `Vector4` sets the column.
105
+ */
106
+ get c2(): Readonly<Vector4>;
107
+ set c2(value: Vector4);
108
+ /**
109
+ * The fourth column. A read returns a new `Vector4`, so writing one of its
110
+ * fields changes nothing; assigning a whole `Vector4` sets the column.
111
+ */
112
+ get c3(): Readonly<Vector4>;
113
+ set c3(value: Vector4);
114
+ mul: LuaMultiplicationMethod<Matrix4, Matrix4> &
115
+ LuaMultiplicationMethod<Vector4, Vector4> &
116
+ LuaMultiplicationMethod<number, Matrix4>;
117
+ }
118
+
119
+ /**
120
+ * An array constant read back from a constant buffer: the engine's 1-based
121
+ * proxy over the constant's slots, not a Lua table.
122
+ *
123
+ * @remarks
124
+ * `cb.lights[1]` reads the first slot and an index below 1 raises. The proxy
125
+ * has no length, so it does not support `#` or `.length`; assign a whole new
126
+ * array (`cb.lights = [a, b]`) to change how many slots the constant holds.
127
+ */
128
+ export interface ConstantArray<T> {
129
+ [index: number]: T;
88
130
  }
89
131
 
90
132
  declare const HashBrand: unique symbol;
@@ -145,9 +187,12 @@ declare const OpaqueBrand: unique symbol;
145
187
  * types, and passing a texture where a node is expected is a compile error,
146
188
  * exactly as a wrong primitive would be. The brand is a phantom `unique symbol`
147
189
  * property that lives only in the type system and is erased at transpile — at
148
- * runtime the value is just the engine's userdata. Because the symbol is never
149
- * exported, your code cannot fabricate a handle or inspect or construct one; the
150
- * engine API is the only source.
190
+ * runtime the value is whatever the engine hands out: usually its userdata, but a
191
+ * plain number for render-target and texture handles (`render.render_target`,
192
+ * the `handle` field of `resource.get_texture_info`). The brand exists only at
193
+ * compile time either way. Because the symbol is never exported, your code
194
+ * cannot fabricate a handle or inspect or construct one; the engine API is the
195
+ * only source.
151
196
  *
152
197
  * The handle kinds modeled today:
153
198
  * - GUI & rendering: `Opaque<"node">`, `Opaque<"texture">`,
@@ -158,6 +203,8 @@ declare const OpaqueBrand: unique symbol;
158
203
  * - Box2D physics: `Opaque<"b2Body">`, `Opaque<"b2World">`
159
204
  * - Generic: `Opaque<"userdata">`
160
205
  *
206
+ * A buffer's `buf.length()` compiles to `#buf` and returns its element count.
207
+ *
161
208
  * @example
162
209
  * Handles always come back from the engine — for instance:
163
210
  * ```ts
@@ -181,14 +228,27 @@ export interface Opaque<Name extends string> {
181
228
 
182
229
  /**
183
230
  * A message-passing address with `socket`, `path`, and `fragment` components.
231
+ *
232
+ * @remarks
233
+ * Each field is writable and takes a `Hash` or a string, which the engine
234
+ * hashes. Every field reads `undefined` when unset, so narrow it before use. A
235
+ * socket-only address (`msg.url("main:")`) has no `path`. `socket` is unset on
236
+ * the `sender` of an engine message posted with no sender, such as
237
+ * `ray_cast_response` and `ray_cast_missed` from `physics.raycast_async`,
238
+ * `animation_done` from a `model.play_anim` with no callback, and
239
+ * `window_resized` in a render script, and after `url.socket = undefined`.
240
+ * Assigning `undefined` clears any of the three fields.
184
241
  */
185
242
  export interface Url {
186
- readonly socket: Hash;
187
- readonly path: Hash;
188
- readonly fragment: Hash | undefined;
243
+ get socket(): Hash | undefined;
244
+ set socket(value: Hash | string | undefined);
245
+ get path(): Hash | undefined;
246
+ set path(value: Hash | string | undefined);
247
+ get fragment(): Hash | undefined;
248
+ set fragment(value: Hash | string | undefined);
189
249
  }
190
250
 
191
- const BUFFER_TYPE = 'Opaque<"buffer">';
251
+ const BUFFER_TYPE = 'Opaque<"buffer"> & { length: LuaLengthMethod<number> }';
192
252
  const BUFFERSTREAM_TYPE =
193
253
  'Opaque<"bufferstream"> & { [index: number]: number; length: LuaLengthMethod<number> }';
194
254
 
@@ -219,7 +279,7 @@ export const DEFOLD_TYPE_MAP: Readonly<Record<string, string>> = {
219
279
  render_target: 'Opaque<"render_target">',
220
280
  constant: 'Opaque<"constant">',
221
281
  constant_buffer:
222
- 'Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | Vector4[] | Matrix4[] }',
282
+ 'Opaque<"constant_buffer"> & { [name: string]: Vector4 | Matrix4 | ConstantArray<Vector4> | ConstantArray<Matrix4> }',
223
283
  buffer: BUFFER_TYPE,
224
284
  bufferstream: BUFFERSTREAM_TYPE,
225
285
  userdata: 'Opaque<"userdata">',
@@ -252,15 +312,17 @@ export const DEFOLD_TYPE_MAP: Readonly<Record<string, string>> = {
252
312
  any: "unknown",
253
313
  // 1.13.2 renames of the leaves above, same slots. Upstream declares each only as
254
314
  // a `userdata`/`number` handle TYPEDEF, so each keeps its 1.13.1 mapping, with
255
- // two exceptions: `script_instance` is the untyped `self` a callback recovery
256
- // emits, and `resource_data` (1.13.1 `resource`, only in the hand-authored
257
- // `go.get`/`go.set`/`go.property` slots) is a path hash.
315
+ // three exceptions: `script_instance` is the untyped `self` a callback recovery
316
+ // emits, `resource_data` (1.13.1 `resource`, only in the hand-authored
317
+ // `go.get`/`go.set`/`go.property` slots) is a path hash, and `render_predicate`
318
+ // (1.13.1 `number`) is the userdata `render.predicate` returns and
319
+ // render_script.cpp:RenderScriptPredicate_Check reads.
258
320
  buffer_data: BUFFER_TYPE,
259
321
  buffer_stream: BUFFERSTREAM_TYPE,
260
322
  script_instance: "unknown",
261
323
  resource_data: "Hash",
262
324
  timer_handle: "number",
263
- render_predicate: "number",
325
+ render_predicate: 'Opaque<"render_predicate">',
264
326
  socket_client: "client",
265
327
  socket_connected: "connected",
266
328
  socket_master: "master",
@@ -2,14 +2,15 @@ import { fnv1a64 } from "./fnv1a";
2
2
 
3
3
  // A function slot whose upstream doc HTML is malformed badly enough to misread,
4
4
  // replaced wholesale with authored HTML that keeps upstream's wording, or a
5
- // property description that contradicts what the engine does. Each
5
+ // function or property doc that contradicts what the engine does. Each
6
6
  // entry is pinned by the FNV-1a hash of the exact upstream HTML it replaces: the
7
7
  // parse applies it only while the vendored doc still hashes to that value, so a
8
8
  // fixed or reworded upstream doc wins by itself, and
9
9
  // `doc-correction-provenance.test.ts` reds until the stale entry is deleted.
10
10
  //
11
- // Keyed `<function>#param:<name>`, `<function>#return:<name>`, or
12
- // `<namespace>#property:<name>` (the ref-doc `PROPERTY` element's bare name).
11
+ // Keyed `<function>#param:<name>`, `<function>#return:<name>`, `<function>#brief`,
12
+ // `<function>#description`, or `<namespace>#property:<name>` (the ref-doc
13
+ // `PROPERTY` element's bare name).
13
14
  export interface DocCorrection {
14
15
  readonly upstreamHash: string;
15
16
  readonly html: string;
@@ -19,6 +20,9 @@ export interface DocCorrection {
19
20
  const li = (name: string, type: string, doc: string) =>
20
21
  `<li><code>${name}</code> <span class="type">${type}</span> ${doc}</li>`;
21
22
 
23
+ const GET_BYTES_REASON =
24
+ "script_buffer.cpp:GetBytes reads only argument 1 with CheckBufferUnpack and pushes every byte of the buffer, so no stream is selected";
25
+
22
26
  export const DOC_CORRECTIONS: ReadonlyMap<string, DocCorrection> = new Map([
23
27
  [
24
28
  "graphics.get_adapter_info#return:info",
@@ -90,14 +94,58 @@ export const DOC_CORRECTIONS: ReadonlyMap<string, DocCorrection> = new Map([
90
94
  html: "The scale of the label. <code>go.get</code> returns and <code>go.set</code> takes a vector3; <code>go.animate</code> also takes a number, which sets a uniform scale.",
91
95
  },
92
96
  ],
97
+ [
98
+ "buffer.get_bytes#brief",
99
+ {
100
+ upstreamHash: "e30a9df6b7f4f67d",
101
+ reason: GET_BYTES_REASON,
102
+ html: "gets all the bytes of a buffer",
103
+ },
104
+ ],
105
+ [
106
+ "buffer.get_bytes#description",
107
+ {
108
+ upstreamHash: "0f16f8e9dce4eb3a",
109
+ reason: GET_BYTES_REASON,
110
+ html: "Get a copy of all the bytes of the buffer, every stream included, as a Lua string.",
111
+ },
112
+ ],
113
+ [
114
+ "buffer.get_bytes#param:stream_name",
115
+ {
116
+ upstreamHash: "cfd40e4525c59409",
117
+ reason: GET_BYTES_REASON,
118
+ html: "the name of the stream; the engine ignores it and returns every byte of the buffer",
119
+ },
120
+ ],
121
+ [
122
+ "gui.clone_tree#param:node",
123
+ {
124
+ upstreamHash: "5c72743d24931629",
125
+ reason:
126
+ "gui_script.cpp:LuaCloneTree tests argument 1 with lua_isnil after pushing its result table, so nil selects the whole scene and an absent argument raises",
127
+ html: "root node to clone, or <code>nil</code> to clone the whole scene; leaving the argument out raises an error",
128
+ },
129
+ ],
130
+ [
131
+ "gui.get_tree#param:node",
132
+ {
133
+ upstreamHash: "47ef2cdd6bf46434",
134
+ reason:
135
+ "gui_script.cpp:LuaGetTree tests argument 1 with lua_isnil after pushing its result table, so nil selects the whole scene and an absent argument raises",
136
+ html: "root node to get node tree from, or <code>nil</code> to get the whole scene; leaving the argument out raises an error",
137
+ },
138
+ ],
93
139
  ]);
94
140
 
141
+ export function docCorrectionKey(owner: string, slot: "brief" | "description"): string;
95
142
  export function docCorrectionKey(
96
143
  owner: string,
97
144
  slot: "param" | "return" | "property",
98
145
  name: string,
99
- ): string {
100
- return `${owner}#${slot}:${name}`;
146
+ ): string;
147
+ export function docCorrectionKey(owner: string, slot: string, name?: string): string {
148
+ return name === undefined ? `${owner}#${slot}` : `${owner}#${slot}:${name}`;
101
149
  }
102
150
 
103
151
  // The slot's doc with its correction applied, or `doc` itself when the slot has