@defold-typescript/types 0.40.0 → 0.42.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 (224) hide show
  1. package/api-availability.json +3963 -772
  2. package/api-migrations.json +27 -0
  3. package/api-signatures.json +18069 -10240
  4. package/api-targets.json +448 -11
  5. package/examples/translations.json +560 -89
  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 +183 -20
  13. package/generated/b2d_world.d.ts +57 -63
  14. package/generated/buffer.d.ts +16 -15
  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 +29 -32
  23. package/generated/collectionfactory.d.ts +15 -18
  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 +235 -182
  37. package/generated/graphics.d.ts +335 -97
  38. package/generated/gui.d.ts +240 -471
  39. package/generated/html5.d.ts +2 -2
  40. package/generated/http.d.ts +28 -35
  41. package/generated/image.d.ts +105 -72
  42. package/generated/json.d.ts +34 -16
  43. package/generated/kinds/gui-script.d.ts +7 -0
  44. package/generated/kinds/render-script.d.ts +7 -0
  45. package/generated/kinds/script.d.ts +7 -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 +40 -39
  50. package/generated/particlefx.d.ts +19 -28
  51. package/generated/physics.d.ts +365 -133
  52. package/generated/profiler.d.ts +13 -23
  53. package/generated/render.d.ts +237 -297
  54. package/generated/resource.d.ts +664 -583
  55. package/generated/socket.d.ts +120 -133
  56. package/generated/sound.d.ts +62 -31
  57. package/generated/sprite.d.ts +31 -17
  58. package/generated/sys.d.ts +234 -190
  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 +1 -3
  63. package/generated/versions/defold-1.12.4/camera.d.ts +21 -21
  64. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +9 -9
  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 +6 -12
  69. package/generated/versions/defold-1.12.4/gui.d.ts +77 -175
  70. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  71. package/generated/versions/defold-1.12.4/http.d.ts +0 -13
  72. package/generated/versions/defold-1.12.4/image.d.ts +16 -33
  73. package/generated/versions/defold-1.12.4/index.d.ts +1 -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 +2 -10
  78. package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
  79. package/generated/versions/defold-1.12.4/physics.d.ts +69 -67
  80. package/generated/versions/defold-1.12.4/profiler.d.ts +2 -5
  81. package/generated/versions/defold-1.12.4/render.d.ts +99 -128
  82. package/generated/versions/defold-1.12.4/resource.d.ts +120 -148
  83. package/generated/versions/defold-1.12.4/socket.d.ts +34 -60
  84. package/generated/versions/defold-1.12.4/sound.d.ts +8 -8
  85. package/generated/versions/defold-1.12.4/sprite.d.ts +15 -5
  86. package/generated/versions/defold-1.12.4/sys.d.ts +37 -71
  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 +0 -21
  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 +169 -8
  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 +1 -3
  96. package/generated/versions/defold-1.13.0/camera.d.ts +25 -25
  97. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +9 -9
  98. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
  99. package/generated/versions/defold-1.13.0/compute.d.ts +0 -69
  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 +6 -12
  105. package/generated/versions/defold-1.13.0/graphics.d.ts +73 -37
  106. package/generated/versions/defold-1.13.0/gui.d.ts +77 -175
  107. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  108. package/generated/versions/defold-1.13.0/http.d.ts +0 -13
  109. package/generated/versions/defold-1.13.0/image.d.ts +16 -33
  110. package/generated/versions/defold-1.13.0/index.d.ts +1 -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 +68 -106
  115. package/generated/versions/defold-1.13.0/model.d.ts +2 -10
  116. package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
  117. package/generated/versions/defold-1.13.0/physics.d.ts +69 -67
  118. package/generated/versions/defold-1.13.0/profiler.d.ts +2 -5
  119. package/generated/versions/defold-1.13.0/render.d.ts +99 -128
  120. package/generated/versions/defold-1.13.0/resource.d.ts +126 -150
  121. package/generated/versions/defold-1.13.0/socket.d.ts +34 -60
  122. package/generated/versions/defold-1.13.0/sound.d.ts +8 -8
  123. package/generated/versions/defold-1.13.0/sprite.d.ts +15 -5
  124. package/generated/versions/defold-1.13.0/sys.d.ts +37 -71
  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 +0 -21
  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 +1 -21
  182. package/generated/window.d.ts +71 -71
  183. package/identity-vocabulary.json +561 -0
  184. package/index.d.ts +7 -0
  185. package/package.json +18 -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 +12 -2
  191. package/scripts/import-defold-release.ts +106 -26
  192. package/scripts/prose-constants.ts +77 -16
  193. package/scripts/regen.ts +391 -77
  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 +48 -10
  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/core-types.ts +26 -3
  201. package/src/correction-pins.ts +49 -0
  202. package/src/doc-comment.ts +104 -11
  203. package/src/doc-corrections.ts +108 -0
  204. package/src/editor-vm-globals.d.ts +5 -2
  205. package/src/emit-dts.ts +2064 -281
  206. package/src/emit-messages.ts +52 -0
  207. package/src/example-store.ts +125 -14
  208. package/src/field-correction-coverage.ts +204 -0
  209. package/src/fnv1a.ts +16 -0
  210. package/src/go-overloads.d.ts +25 -6
  211. package/src/index-base-table.ts +145 -0
  212. package/src/index-slot-classifications.ts +588 -0
  213. package/src/index.ts +38 -5
  214. package/src/library-index-slot-classifications.ts +332 -0
  215. package/src/lifecycle.ts +61 -199
  216. package/src/luals-type-expr.ts +354 -0
  217. package/src/msg-overloads.d.ts +0 -1
  218. package/src/param-correction-provenance.ts +8 -11
  219. package/src/render-overloads.d.ts +0 -15
  220. package/src/return-correction-provenance.ts +58 -16
  221. package/src/sys-overloads.d.ts +48 -0
  222. package/src/vmath-overloads.d.ts +27 -1
  223. package/src/window-event-guard.d.ts +6 -9
  224. package/url-parameters.json +1 -2
@@ -0,0 +1,678 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Opaque } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions and messages for using system resources, controlling the engine,
7
+ * error handling and debugging.
8
+ */
9
+ namespace sys {
10
+ type NetworkConnectivity = typeof sys.NETWORK_DISCONNECTED | typeof sys.NETWORK_CONNECTED_CELLULAR | typeof sys.NETWORK_CONNECTED;
11
+ /**
12
+ * network connected through other, non cellular, connection
13
+ */
14
+ const NETWORK_CONNECTED: number & { readonly __brand: "sys.NETWORK_CONNECTED" };
15
+ /**
16
+ * network connected through mobile cellular
17
+ */
18
+ const NETWORK_CONNECTED_CELLULAR: number & { readonly __brand: "sys.NETWORK_CONNECTED_CELLULAR" };
19
+ /**
20
+ * no network connection found
21
+ */
22
+ const NETWORK_DISCONNECTED: number & { readonly __brand: "sys.NETWORK_DISCONNECTED" };
23
+ /**
24
+ * an asyncronous request is unable to read the resource
25
+ */
26
+ const REQUEST_STATUS_ERROR_IO_ERROR: number & { readonly __brand: "sys.REQUEST_STATUS_ERROR_IO_ERROR" };
27
+ /**
28
+ * an asyncronous request is unable to locate the resource
29
+ */
30
+ const REQUEST_STATUS_ERROR_NOT_FOUND: number & { readonly __brand: "sys.REQUEST_STATUS_ERROR_NOT_FOUND" };
31
+ /**
32
+ * an asyncronous request has finished successfully
33
+ */
34
+ const REQUEST_STATUS_FINISHED: number & { readonly __brand: "sys.REQUEST_STATUS_FINISHED" };
35
+ /**
36
+ * This function will raise a Lua error if an error occurs while deserializing the buffer.
37
+ *
38
+ * @param buffer - buffer to deserialize from
39
+ * @returns lua table with deserialized data
40
+ * @example
41
+ * ```ts
42
+ * // Deserialize a table that was previously serialized:
43
+ * const my_table = { score: 100, level: 3 };
44
+ * const buffer = sys.serialize(my_table);
45
+ * const table = sys.deserialize(buffer);
46
+ * ```
47
+ */
48
+ function deserialize(buffer: string): Record<string | number, unknown>;
49
+ /**
50
+ * Check if a path exists
51
+ * Good for checking if a file exists before loading a large file
52
+ *
53
+ * @param path - path to check
54
+ * @returns `true` if the path exists, `false` otherwise
55
+ * @example
56
+ * ```ts
57
+ * // Load data but return nil if path didn't exist
58
+ * function load_data(path: string) {
59
+ * if (!sys.exists(path)) {
60
+ * return undefined;
61
+ * }
62
+ * return sys.load(path); // returns {} if it failed
63
+ * }
64
+ * ```
65
+ */
66
+ function exists(path: string): boolean;
67
+ /**
68
+ * Terminates the game application and reports the specified `code` to the OS.
69
+ *
70
+ * @param code - exit code to report to the OS, 0 means clean exit
71
+ * @example
72
+ * ```ts
73
+ * // This example demonstrates how to exit the application when some kind of quit
74
+ * // message is received (maybe from gui or similar):
75
+ * export default defineScript({
76
+ * on_message(self, message_id, message, sender) {
77
+ * if (message_id === hash("quit")) {
78
+ * sys.exit(0);
79
+ * }
80
+ * },
81
+ * });
82
+ * ```
83
+ */
84
+ function exit(code: number): void;
85
+ /**
86
+ * Returns a table with application information for the requested app.
87
+ * On iOS, the `app_string` is an url scheme for the app that is queried. Your
88
+ * game needs to list the schemes that are queried in an `LSApplicationQueriesSchemes` array
89
+ * in a custom "Info.plist".
90
+ * On Android, the `app_string` is the package identifier for the app.
91
+ *
92
+ * @param app_string - platform specific string with application package or query, see above for details.
93
+ * @returns table with application information in the following fields:
94
+ *
95
+ * `installed`
96
+ * boolean `true` if the application is installed, `false` otherwise.
97
+ * @example
98
+ * Check if twitter is installed:
99
+ * ```ts
100
+ * const sysinfo = sys.get_sys_info();
101
+ * let twitter: { installed?: boolean } = {};
102
+ *
103
+ * if (sysinfo.system_name === "Android") {
104
+ * twitter = sys.get_application_info("com.twitter.android");
105
+ * } else if (sysinfo.system_name === "iPhone OS") {
106
+ * twitter = sys.get_application_info("twitter:");
107
+ * }
108
+ *
109
+ * if (twitter.installed) {
110
+ * // twitter is installed!
111
+ * }
112
+ * ```
113
+ * @example
114
+ * Info.plist for the iOS app needs to list the schemes that are queried:
115
+ * ```ts
116
+ * // ...
117
+ * // <key>LSApplicationQueriesSchemes</key>
118
+ * // <array>
119
+ * // <string>twitter</string>
120
+ * // </array>
121
+ * // ...
122
+ * ```
123
+ */
124
+ function get_application_info(app_string: string): { installed: boolean };
125
+ /**
126
+ * The path from which the application is run.
127
+ * This function will raise a Lua error if unable to get the application support path.
128
+ *
129
+ * @returns path to application executable
130
+ * @example
131
+ * ```ts
132
+ * // Find a path where we can store data (the example path is on the macOS platform):
133
+ * // macOS: /Applications/my_game.app
134
+ * const application_path = sys.get_application_path();
135
+ * print(application_path); //> /Applications/my_game.app
136
+ *
137
+ * // Windows: C:\Program Files\my_game\my_game.exe
138
+ * print(application_path); //> C:\Program Files\my_game
139
+ *
140
+ * // Linux: /home/foobar/my_game/my_game
141
+ * print(application_path); //> /home/foobar/my_game
142
+ *
143
+ * // Android package name: com.foobar.my_game
144
+ * print(application_path); //> /data/user/0/com.foobar.my_game
145
+ *
146
+ * // iOS: my_game.app
147
+ * print(application_path); //> /var/containers/Bundle/Applications/123456AB-78CD-90DE-12345678ABCD/my_game.app
148
+ *
149
+ * // HTML5: http://www.foobar.com/my_game/
150
+ * print(application_path); //> http://www.foobar.com/my_game
151
+ * ```
152
+ */
153
+ function get_application_path(): string;
154
+ /**
155
+ * Get boolean config value from the game.project configuration file with optional default value
156
+ *
157
+ * @param key - key to get value for. The syntax is SECTION.KEY
158
+ * @param default_value - (optional) default value to return if the value does not exist
159
+ * @returns config value as a boolean. default_value if the config key does not exist. false if no default value was supplied.
160
+ * @example
161
+ * ```ts
162
+ * // Get user config value
163
+ * const vsync = sys.get_config_boolean("display.vsync", false);
164
+ * ```
165
+ */
166
+ function get_config_boolean(key: string, default_value?: boolean): boolean;
167
+ /**
168
+ * Get integer config value from the game.project configuration file with optional default value
169
+ *
170
+ * @param key - key to get value for. The syntax is SECTION.KEY
171
+ * @param default_value - (optional) default value to return if the value does not exist
172
+ * @returns config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
173
+ * @example
174
+ * Get user config value
175
+ * ```ts
176
+ * const speed = sys.get_config_int("my_game.speed", 20); // with default value
177
+ * ```
178
+ * @example
179
+ * ```ts
180
+ * const testmode = sys.get_config_int("my_game.testmode"); // without default value
181
+ * if (testmode !== undefined) {
182
+ * // do stuff
183
+ * }
184
+ * ```
185
+ */
186
+ function get_config_int(key: string, default_value?: number): number;
187
+ /**
188
+ * Get number config value from the game.project configuration file with optional default value
189
+ *
190
+ * @param key - key to get value for. The syntax is SECTION.KEY
191
+ * @param default_value - (optional) default value to return if the value does not exist
192
+ * @returns config value as an number. default_value if the config key does not exist. 0 if no default value was supplied.
193
+ * @example
194
+ * ```ts
195
+ * // Get user config value
196
+ * const speed = sys.get_config_number("my_game.speed", 20.0);
197
+ * ```
198
+ */
199
+ function get_config_number(key: string, default_value?: number): number;
200
+ /**
201
+ * Returns the current network connectivity status
202
+ * on mobile platforms.
203
+ * On desktop, this function always return `sys.NETWORK_CONNECTED`.
204
+ *
205
+ * @returns network connectivity status:
206
+ *
207
+ * - `sys.NETWORK_DISCONNECTED` (no network connection is found)
208
+ * - `sys.NETWORK_CONNECTED_CELLULAR` (connected through mobile cellular)
209
+ * - `sys.NETWORK_CONNECTED` (otherwise, Wifi)
210
+ * @example
211
+ * ```ts
212
+ * // Check if we are connected through a cellular connection
213
+ * if (sys.NETWORK_CONNECTED_CELLULAR === sys.get_connectivity()) {
214
+ * print("Connected via cellular, avoid downloading big files!");
215
+ * }
216
+ * ```
217
+ */
218
+ function get_connectivity(): sys.NetworkConnectivity;
219
+ /**
220
+ * Returns a table with engine information.
221
+ *
222
+ * @returns table with engine information in the following fields:
223
+ *
224
+ * `version`
225
+ * string The current Defold engine version, i.e. "1.2.96"
226
+ * `version_sha1`
227
+ * string The SHA1 for the current engine build, i.e. "0060183cce2e29dbd09c85ece83cbb72068ee050"
228
+ * `is_debug`
229
+ * boolean If the engine is a debug or release version
230
+ * @example
231
+ * ```ts
232
+ * // How to retrieve engine information:
233
+ * // Update version text label so our testers know what version we're running
234
+ * const engine_info = sys.get_engine_info();
235
+ * const version_str = `Defold ${engine_info.version}\n${engine_info.version_sha1}`;
236
+ * gui.set_text(gui.get_node("version"), version_str);
237
+ * ```
238
+ */
239
+ function get_engine_info(): { version: string; version_sha1: string; is_debug: boolean };
240
+ /**
241
+ * Create a path to the host device for unit testing
242
+ * Useful for saving logs etc during development
243
+ *
244
+ * @param filename - file to read from
245
+ * @returns the path prefixed with the proper host mount
246
+ * @example
247
+ * Save data on the host
248
+ * ```ts
249
+ * const mytable = { score: 100, level: 3 };
250
+ * const host_path = sys.get_host_path("logs/test.txt");
251
+ * sys.save(host_path, mytable);
252
+ * ```
253
+ * @example
254
+ * Load data from the host
255
+ * ```ts
256
+ * const host_path = sys.get_host_path("logs/test.txt");
257
+ * const table = sys.load(host_path);
258
+ * ```
259
+ */
260
+ function get_host_path(filename: string): string;
261
+ /**
262
+ * Returns an array of tables with information on network interfaces.
263
+ *
264
+ * @returns an array of tables. Each table entry contain the following fields:
265
+ *
266
+ * `name`
267
+ * string Interface name
268
+ * `address`
269
+ * string IP address. might be `nil` if not available.
270
+ * `mac`
271
+ * string Hardware MAC address. might be nil if not available.
272
+ * `up`
273
+ * boolean `true` if the interface is up (available to transmit and receive data), `false` otherwise.
274
+ * `running`
275
+ * boolean `true` if the interface is running, `false` otherwise.
276
+ * @example
277
+ * ```ts
278
+ * // How to get the IP address of interface "en0":
279
+ * const ifaddrs = sys.get_ifaddrs();
280
+ * for (const iface of ifaddrs) {
281
+ * if (iface.name === "en0") {
282
+ * const ip = iface.address;
283
+ * }
284
+ * }
285
+ * ```
286
+ */
287
+ function get_ifaddrs(): { name: string; address?: string; mac?: string; up: boolean; running: boolean }[];
288
+ /**
289
+ * The save-file path is operating system specific and is typically located under the user's home directory.
290
+ * This function will raise a Lua error if unable to get the save file path.
291
+ *
292
+ * @param application_id - user defined id of the application, which helps define the location of the save-file
293
+ * @param file_name - file-name to get path for
294
+ * @returns path to save-file
295
+ * @example
296
+ * ```ts
297
+ * // Find a path where we can store data:
298
+ * const my_file_path = sys.get_save_file("my_game", "my_file");
299
+ * // macOS: /Users/foobar/Library/Application Support/my_game/my_file
300
+ * print(my_file_path); //> /Users/foobar/Library/Application Support/my_game/my_file
301
+ *
302
+ * // Windows: C:\Users\foobar\AppData\Roaming\my_game\my_file
303
+ * print(my_file_path); //> C:\Users\foobar\AppData\Roaming\my_game\my_file
304
+ *
305
+ * // Linux: $XDG_DATA_HOME/my_game/my_file or /home/foobar/.my_game/my_file
306
+ * // Linux: Defaults to /home/foobar/.local/share/my_game/my_file if neither exist.
307
+ * print(my_file_path); //> /home/foobar/.local/share/my_game/my_file
308
+ *
309
+ * // Android package name: com.foobar.packagename
310
+ * print(my_file_path); //> /data/data/0/com.foobar.packagename/files/my_file
311
+ *
312
+ * // iOS: my_game.app
313
+ * print(my_file_path); //> /var/mobile/Containers/Data/Application/123456AB-78CD-90DE-12345678ABCD/my_game/my_file
314
+ *
315
+ * // HTML5 path inside the IndexedDB: /data/.my_game/my_file or /.my_game/my_file
316
+ * print(my_file_path); //> /data/.my_game/my_file
317
+ * ```
318
+ */
319
+ function get_save_file(application_id: string, file_name: string): string;
320
+ /**
321
+ * Returns a table with system information.
322
+ *
323
+ * @param options - optional options table
324
+ * - ignore_secure boolean this flag ignores values might be secured by OS e.g. `device_ident`
325
+ * @returns table with system information in the following fields:
326
+ *
327
+ * `device_model`
328
+ * string Only available on iOS and Android.
329
+ * `manufacturer`
330
+ * string Only available on iOS and Android.
331
+ * `system_name`
332
+ * string The system name: "Darwin", "Linux", "Windows", "HTML5", "Android" or "iPhone OS"
333
+ * `system_version`
334
+ * string The system OS version.
335
+ * `api_version`
336
+ * string The API version on the system.
337
+ * `language`
338
+ * string Two character ISO-639 format, i.e. "en".
339
+ * `device_language`
340
+ * string Two character ISO-639 format (i.e. "sr") and, if applicable, followed by a dash (-) and an ISO 15924 script code (i.e. "sr-Cyrl" or "sr-Latn"). Reflects the device preferred language.
341
+ * `territory`
342
+ * string Two character ISO-3166 format, i.e. "US".
343
+ * `gmt_offset`
344
+ * number The current offset from GMT (Greenwich Mean Time), in minutes.
345
+ * `device_ident`
346
+ * string This value secured by OS. "identifierForVendor" on iOS. "android_id" on Android. On Android, you need to add `READ_PHONE_STATE` permission to be able to get this data. We don't use this permission in Defold.
347
+ * `user_agent`
348
+ * string The HTTP user agent, i.e. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
349
+ * @example
350
+ * ```ts
351
+ * // How to get system information:
352
+ * const info = sys.get_sys_info();
353
+ * if (info.system_name === "HTML5") {
354
+ * // We are running in a browser.
355
+ * }
356
+ * ```
357
+ */
358
+ function get_sys_info(options?: { ignore_secure?: boolean }): { device_model?: string; manufacturer?: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident?: string; user_agent?: string };
359
+ /**
360
+ * If the file exists, it must have been created by `sys.save` to be loaded.
361
+ * This function will raise a Lua error if an error occurs while loading the file.
362
+ *
363
+ * @param filename - file to read from
364
+ * @returns lua table, which is empty if the file could not be found
365
+ * @example
366
+ * ```ts
367
+ * // Load data that was previously saved, e.g. an earlier game session:
368
+ * const my_file_path = sys.get_save_file("my_game", "my_file");
369
+ * const my_table = sys.load(my_file_path);
370
+ * if (!next(my_table)) {
371
+ * // empty table
372
+ * }
373
+ * ```
374
+ */
375
+ function load(filename: string): Record<string | number, unknown>;
376
+ /**
377
+ * The sys.load_buffer function will first try to load the resource
378
+ * from any of the mounted resource locations and return the data if
379
+ * any matching entries found. If not, the path will be tried
380
+ * as is from the primary disk on the device.
381
+ * In order for the engine to include custom resources in the build process, you need
382
+ * to specify them in the "custom_resources" key in your "game.project" settings file.
383
+ * You can specify single resource files or directories. If a directory is included
384
+ * in the resource list, all files and directories in that directory is recursively
385
+ * included:
386
+ * For example "main/data/,assets/level_data.json".
387
+ *
388
+ * @param path - the path to load the buffer from
389
+ * @returns the buffer with data
390
+ * @example
391
+ * Load binary data from a custom project resource:
392
+ * ```ts
393
+ * const my_buffer = sys.load_buffer("/assets/my_level_data.bin");
394
+ * const data_str = buffer.get_bytes(my_buffer, "data");
395
+ * const has_my_header = data_str.slice(0, 6) === "D3F0LD";
396
+ * ```
397
+ * @example
398
+ * Load binary data from non-custom resource files on disk:
399
+ * ```ts
400
+ * const asset_1 = sys.load_buffer("folder_next_to_binary/my_level_asset.txt");
401
+ * const asset_2 = sys.load_buffer("/my/absolute/path");
402
+ * ```
403
+ */
404
+ function load_buffer(path: string): Opaque<"buffer">;
405
+ /**
406
+ * The sys.load_buffer function will first try to load the resource
407
+ * from any of the mounted resource locations and return the data if
408
+ * any matching entries found. If not, the path will be tried
409
+ * as is from the primary disk on the device.
410
+ * In order for the engine to include custom resources in the build process, you need
411
+ * to specify them in the "custom_resources" key in your "game.project" settings file.
412
+ * You can specify single resource files or directories. If a directory is included
413
+ * in the resource list, all files and directories in that directory is recursively
414
+ * included:
415
+ * For example "main/data/,assets/level_data.json".
416
+ * Note that issuing multiple requests of the same resource will yield
417
+ * individual buffers per request. There is no implic caching of the buffers
418
+ * based on request path.
419
+ *
420
+ * @param path - the path to load the buffer from
421
+ * @param status_callback - A status callback that will be invoked when a request has been handled, or an error occured. The result is a table containing:
422
+ *
423
+ * `status`
424
+ * number The status of the request, supported values are:
425
+ *
426
+ * - `resource.REQUEST_STATUS_FINISHED`
427
+ * - `resource.REQUEST_STATUS_ERROR_IO_ERROR`
428
+ * - `resource.REQUEST_STATUS_ERROR_NOT_FOUND`
429
+ *
430
+ * `buffer`
431
+ * buffer If the request was successfull, this will contain the request payload in a buffer object, and nil otherwise. Make sure to check the status before doing anything with the buffer value!
432
+ * @returns a handle to the request
433
+ * @example
434
+ * Load binary data from a custom project resource and update a texture resource:
435
+ * ```ts
436
+ * function my_callback(self: unknown, request_id: unknown, result: unknown) {
437
+ * const { status, buf } = result as { status: number; buf: Opaque<"buffer"> };
438
+ * if (status === sys.REQUEST_STATUS_FINISHED) {
439
+ * resource.set_texture("/my_texture", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format: graphics.TEXTURE_FORMAT_RGBA }, buf);
440
+ * }
441
+ * }
442
+ *
443
+ * const my_request = sys.load_buffer_async("/assets/my_level_data.bin", my_callback);
444
+ * ```
445
+ * @example
446
+ * Load binary data from non-custom resource files on disk:
447
+ * ```ts
448
+ * function my_callback(self: unknown, request_id: unknown, result: unknown) {
449
+ * const { first_asset, second_asset } = self as { first_asset: Hash; second_asset: Hash };
450
+ * if ((result as { status: number }).status !== sys.REQUEST_STATUS_FINISHED) {
451
+ * // uh oh! File could not be found, do something graceful
452
+ * } else if (request_id === first_asset) {
453
+ * // result.buffer contains data from my_level_asset.bin
454
+ * } else if (request_id === second_asset) {
455
+ * // result.buffer contains data from 'my_level.bin'
456
+ * }
457
+ * }
458
+ *
459
+ * export default defineScript({
460
+ * init() {
461
+ * const first_path = "folder_next_to_binary/my_level_asset.bin";
462
+ * const second_path = "/some_absolute_path/my_level.bin";
463
+ * return {
464
+ * first_asset: hash(first_path),
465
+ * second_asset: hash(second_path),
466
+ * first_request: sys.load_buffer_async(first_path, my_callback),
467
+ * second_request: sys.load_buffer_async(second_path, my_callback),
468
+ * };
469
+ * },
470
+ * });
471
+ * ```
472
+ */
473
+ function load_buffer_async(path: string, status_callback: (self: unknown, request_id: unknown, result: unknown) => void): number;
474
+ /**
475
+ * Loads a custom resource. Specify the full filename of the resource that you want
476
+ * to load. When loaded, the file data is returned as a string.
477
+ * If loading fails, the function returns `nil` plus the error message.
478
+ * In order for the engine to include custom resources in the build process, you need
479
+ * to specify them in the "custom_resources" key in your "game.project" settings file.
480
+ * You can specify single resource files or directories. If a directory is included
481
+ * in the resource list, all files and directories in that directory is recursively
482
+ * included:
483
+ * For example "main/data/,assets/level_data.json".
484
+ *
485
+ * @param filename - resource to load, full path
486
+ * @example
487
+ * ```ts
488
+ * // Load level data into a string
489
+ * const [data, error] = sys.load_resource("/assets/level_data.json");
490
+ * // Decode json string to a table
491
+ * if (data) {
492
+ * const data_table = json.decode(data);
493
+ * pprint(data_table);
494
+ * } else {
495
+ * print(error);
496
+ * }
497
+ * ```
498
+ */
499
+ function load_resource(filename: string): LuaMultiReturn<[string | undefined, string | undefined]>;
500
+ /**
501
+ * Open URL in default application, typically a browser
502
+ *
503
+ * @param url - url to open
504
+ * @param attributes - table with attributes
505
+ * `target`
506
+ * - string : Optional. Specifies the target attribute or the name of the window. The following values are supported:
507
+ * - `_self` - (default value) URL replaces the current page.
508
+ * - `_blank` - URL is loaded into a new window, or tab.
509
+ * - `_parent` - URL is loaded into the parent frame.
510
+ * - `_top` - URL replaces any framesets that may be loaded.
511
+ * - `name` - The name of the window (Note: the name does not specify the title of the new window).
512
+ * @returns a boolean indicating if the url could be opened or not
513
+ * @example
514
+ * ```ts
515
+ * // Open an URL:
516
+ * const success = sys.open_url("http://www.defold.com", { target: "_blank" });
517
+ * if (!success) {
518
+ * // could not open the url...
519
+ * }
520
+ * ```
521
+ */
522
+ function open_url(url: string, attributes?: { target?: string }): boolean;
523
+ /**
524
+ * Reboots the game engine with a specified set of arguments.
525
+ * Arguments will be translated into command line arguments. Calling reboot
526
+ * function is equivalent to starting the engine with the same arguments.
527
+ * On startup the engine reads configuration from "game.project" in the
528
+ * project root.
529
+ *
530
+ * @param arg1 - argument 1
531
+ * @param arg2 - argument 2
532
+ * @param arg3 - argument 3
533
+ * @param arg4 - argument 4
534
+ * @param arg5 - argument 5
535
+ * @param arg6 - argument 6
536
+ * @example
537
+ * ```ts
538
+ * // How to reboot engine with a specific bootstrap collection.
539
+ * const arg1 = "--config=bootstrap.main_collection=/my.collectionc";
540
+ * const arg2 = "build/game.projectc";
541
+ * sys.reboot(arg1, arg2);
542
+ * ```
543
+ */
544
+ function reboot(arg1?: string, arg2?: string, arg3?: string, arg4?: string, arg5?: string, arg6?: string): void;
545
+ /**
546
+ * The table can later be loaded by `sys.load`.
547
+ * Use `sys.get_save_file` to obtain a valid location for the file.
548
+ * Internally, this function uses a workspace buffer sized output file sized 512kb.
549
+ * This size reflects the output file size which must not exceed this limit.
550
+ * Additionally, the total number of rows that any one table may contain is limited to 65536
551
+ * (i.e. a 16 bit range). When tables are used to represent arrays, the values of
552
+ * keys are permitted to fall within a 32 bit range, supporting sparse arrays, however
553
+ * the limit on the total number of rows remains in effect.
554
+ * This function will raise a Lua error if an error occurs while saving the table.
555
+ *
556
+ * @param filename - file to write to
557
+ * @param table - lua table to save
558
+ * @example
559
+ * ```ts
560
+ * // Save data:
561
+ * const my_table = [];
562
+ * my_table.push("my_value");
563
+ * const my_file_path = sys.get_save_file("my_game", "my_file");
564
+ * sys.save(my_file_path, my_table);
565
+ * ```
566
+ */
567
+ function save(filename: string, table: Record<string | number, unknown> | readonly unknown[]): boolean;
568
+ /**
569
+ * The buffer can later deserialized by `sys.deserialize`.
570
+ * This function has all the same limitations as `sys.save`.
571
+ * This function will raise a Lua error if an error occurs while serializing the table.
572
+ *
573
+ * @param table - lua table to serialize
574
+ * @returns serialized data buffer
575
+ * @example
576
+ * ```ts
577
+ * // Serialize table:
578
+ * const my_table = [];
579
+ * my_table.push("my_value");
580
+ * const buffer = sys.serialize(my_table);
581
+ * ```
582
+ */
583
+ function serialize(table: Record<string | number, unknown> | readonly unknown[]): string;
584
+ /**
585
+ * Sets the host that is used to check for network connectivity against.
586
+ *
587
+ * @param host - hostname to check against
588
+ * @example
589
+ * ```ts
590
+ * sys.set_connectivity_host("www.google.com");
591
+ * ```
592
+ */
593
+ function set_connectivity_host(host: string): void;
594
+ /**
595
+ * Set the Lua error handler function.
596
+ * The error handler is a function which is called whenever a lua runtime error occurs.
597
+ *
598
+ * @param error_handler - the function to be called on error
599
+ *
600
+ * `source`
601
+ * string The runtime context of the error. Currently, this is always `"lua"`.
602
+ * `message`
603
+ * string The source file, line number and error message.
604
+ * `traceback`
605
+ * string The stack traceback.
606
+ * @example
607
+ * ```ts
608
+ * // Install error handler that just prints the errors
609
+ * function my_error_handler(source: unknown, message: unknown, traceback: unknown) {
610
+ * print(source); //> lua
611
+ * print(message); //> main/my.script:10: attempt to perform arithmetic on a string value
612
+ * print(traceback); //> stack traceback:
613
+ * //> main/test.script:10: in function 'boom'
614
+ * //> main/test.script:15: in function <main/my.script:13>
615
+ * }
616
+ *
617
+ * function boom() {
618
+ * return 10 + "string";
619
+ * }
620
+ *
621
+ * export default defineScript({
622
+ * init() {
623
+ * sys.set_error_handler(my_error_handler);
624
+ * boom();
625
+ * },
626
+ * });
627
+ * ```
628
+ */
629
+ function set_error_handler(error_handler: (source: unknown, message: unknown, traceback: unknown) => void): void;
630
+ /**
631
+ * Disables rendering
632
+ *
633
+ * @param enable - true if throttling should be enabled
634
+ * @example
635
+ * ```ts
636
+ * // Disable rendering
637
+ * sys.set_render_enabled(false);
638
+ * ```
639
+ */
640
+ function set_render_enabled(enable: boolean): void;
641
+ /**
642
+ * Set game update-frequency (frame cap). This option is equivalent to `display.update_frequency` in
643
+ * the "game.project" settings but set in run-time. If `Vsync` checked in "game.project", the rate will
644
+ * be clamped to a swap interval that matches any detected main monitor refresh rate. If `Vsync` is
645
+ * unchecked the engine will try to respect the rate in software using timers. There is no
646
+ * guarantee that the frame cap will be achieved depending on platform specifics and hardware settings.
647
+ *
648
+ * @param frequency - target frequency. 60 for 60 fps
649
+ * @example
650
+ * ```ts
651
+ * // Setting the update frequency to 60 frames per second
652
+ * sys.set_update_frequency(60);
653
+ * ```
654
+ */
655
+ function set_update_frequency(frequency: number): void;
656
+ /**
657
+ * Set the vsync swap interval. The interval with which to swap the front and back buffers
658
+ * in sync with vertical blanks (v-blank), the hardware event where the screen image is updated
659
+ * with data from the front buffer. A value of 1 swaps the buffers at every v-blank, a value of
660
+ * 2 swaps the buffers every other v-blank and so on. A value of 0 disables waiting for v-blank
661
+ * before swapping the buffers. Default value is 1.
662
+ * When setting the swap interval to 0 and having `vsync` disabled in
663
+ * "game.project", the engine will try to respect the set frame cap value from
664
+ * "game.project" in software instead.
665
+ * This setting may be overridden by driver settings.
666
+ *
667
+ * @param swap_interval - target swap interval.
668
+ * @example
669
+ * ```ts
670
+ * // Setting the swap intervall to swap every v-blank
671
+ * sys.set_vsync_swap_interval(1);
672
+ * ```
673
+ */
674
+ function set_vsync_swap_interval(swap_interval: number): void;
675
+ }
676
+ }
677
+
678
+ export {};