You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DefoldDocs/api/game_object.lua
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -140,6 +140,11 @@ function go.cancel_animations(url, property) end
140
140
---@paramrecursiveboolean optional boolean, set to true to recursively delete child hiearchy in child to parent order
141
141
functiongo.delete(id, recursive) end
142
142
143
+
---check if the specified game object exists
144
+
---@paramurlstring|hash|url url of the game object to check
145
+
---@returnbool true if the game object exists
146
+
functiongo.exists(url) end
147
+
143
148
---gets a named property of the specified game object or component
144
149
---@paramurlstring|hash|url url of the game object or component having the property
145
150
---@parampropertystring|hash id of the property to retrieve
@@ -218,7 +223,7 @@ function go.get_world_transform(id) end
218
223
---The properties defined this way are automatically exposed in the editor in game objects and collections which use the script.
219
224
---Note that you can only use this function outside any callback-functions like init and update.
220
225
---@paramnamestring the id of the property
221
-
---@paramvaluenumber|hash|url|vector3|vector4|quaternion|resource default value of the property. In the case of a url, only the empty constructor msg.url() is allowed. In the case of a resource one of the resource constructors (eg resource.atlas(), resource.font() etc) is expected.
226
+
---@paramvaluenumber|hash|url|vector3|vector4|quaternion|resource|boolean default value of the property. In the case of a url, only the empty constructor msg.url() is allowed. In the case of a resource one of the resource constructors (eg resource.atlas(), resource.font() etc) is expected.
222
227
functiongo.property(name, value) end
223
228
224
229
---sets a named property of the specified game object or component, or a material constant
Copy file name to clipboardExpand all lines: DefoldDocs/api/gui.lua
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -208,7 +208,7 @@ gui.SIZE_MODE_MANUAL = nil
208
208
---together. See the examples below for more information.
209
209
---@paramnodenode node to animate
210
210
---@parampropertystring|constant property to animate
211
-
---@paramtovector3|vector4 target property value
211
+
---@paramtonumber|vector3|vector4|quaternion target property value
212
212
---@parameasingconstant|vector easing to use during animation. Either specify one of the gui.EASING_* constants or provide a vector with a custom curve. See the animation guide <> for more information.
213
213
---@paramdurationnumber duration of the animation in seconds.
214
214
---@paramdelaynumber delay before the animation starts in seconds.
@@ -471,6 +471,11 @@ function gui.get_texture(node) end
471
471
---@returnnumber tracking scaling number (default=0)
472
472
functiongui.get_tracking(node) end
473
473
474
+
---Get a node and all its children as a Lua table.
475
+
---@paramnodenode root node to get node tree from
476
+
---@returntable a table mapping node ids to the corresponding nodes
477
+
functiongui.get_tree(node) end
478
+
474
479
---Returns true if a node is visible and false if it's not.
Copy file name to clipboardExpand all lines: DefoldDocs/api/render.lua
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -136,8 +136,8 @@ function render.enable_state(state) end
136
136
---used as texture with the specified unit.
137
137
---A material shader can then use the texture to sample from.
138
138
---@paramunitnumber texture unit to enable texture for
139
-
---@paramrender_targetrender_target render target from which to enable the specified texture unit
140
-
---@parambuffer_typeconstant buffer type from which to enable the texture
139
+
---@paramrender_targethandle render target or texture from which to enable the specified texture unit
140
+
---@parambuffer_typeconstant optional buffer type from which to enable the texture. Note that this argument only applies to render targets. Defaults to render.BUFFER_COLOR_BIT
141
141
functionrender.enable_texture(unit, render_target, buffer_type) end
142
142
143
143
---Returns the logical window height that is set in the "game.project" settings.
@@ -202,6 +202,13 @@ function render.predicate(tags) end
202
202
---The render target can be created to support multiple color attachments. Each attachment can have different format settings and texture filters,
203
203
---but attachments must be added in sequence, meaning you cannot create a render target at slot 0 and 3.
204
204
---Instead it has to be created with all four buffer types ranging from [0..3] (as denoted by render.BUFFER_COLORX_BIT where 'X' is the attachment you want to create).
205
+
---It is not guaranteed that the device running the script can support creating render targets with multiple color attachments. To check if the device can support multiple attachments,
206
+
---you can check if the render table contains any of the BUFFER_COLOR1_BIT, BUFFER_COLOR2_BIT or BUFFER_COLOR3_BIT constants:
207
+
---function init(self)
208
+
--- if render.BUFFER_COLOR1_BIT == nil then
209
+
--- -- this devices does not support multiple color attachments
210
+
--- end
211
+
---end
205
212
---@paramnamestring render target name
206
213
---@paramparameterstable table of buffer parameters, see the description for available keys and values
@@ -95,15 +97,29 @@ function resource.buffer(path) end
95
97
---@returnhash Returns the atlas resource path
96
98
functionresource.create_atlas(path, table) end
97
99
100
+
---This function creates a new buffer resource that can be used in the same way as any buffer created during build time.
101
+
---The function requires a valid buffer created from either buffer.create <> or another pre-existing buffer resource.
102
+
---By default, the new resource will take ownership of the buffer lua reference, meaning the buffer will not automatically be removed
103
+
---when the lua reference to the buffer is garbage collected. This behaviour can be overruled by specifying 'transfer_ownership = false'
104
+
---in the argument table. If the new buffer resource is created from a buffer object that is created by another resource,
105
+
---the buffer object will be copied and the new resource will effectively own a copy of the buffer instead.
106
+
---Note that the path to the new resource must have the '.bufferc' extension, "/path/my_buffer" is not a valid path but "/path/my_buffer.bufferc" is.
107
+
---The path must also be unique, attempting to create a buffer with the same name as an existing resource will raise an error.
108
+
---@parampathstring The path to the resource.
109
+
---@paramtabletable A table containing info about how to create the buffer. Supported entries:
110
+
---@returnhash Returns the buffer resource path
111
+
functionresource.create_buffer(path, table) end
112
+
98
113
---Creates a new texture resource that can be used in the same way as any texture created during build time.
99
114
---The path used for creating the texture must be unique, trying to create a resource at a path that is already
100
115
---registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture <>
101
116
---function. Also note that the path to the new texture resource must have a '.texturec' extension,
102
117
---meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
103
118
---@parampathstring The path to the resource.
104
119
---@paramtabletable A table containing info about how to create the texture. Supported entries:
120
+
---@parambufferbuffer optional buffer of precreated pixel data
105
121
---@returnhash The path to the resource.
106
-
functionresource.create_texture(path, table) end
122
+
functionresource.create_texture(path, table, buffer) end
107
123
108
124
---Constructor-like function with two purposes:
109
125
---
@@ -127,21 +143,17 @@ function resource.get_atlas(path) end
127
143
---@returnbuffer The resource buffer
128
144
functionresource.get_buffer(path) end
129
145
130
-
---Return a reference to the Manifest that is currently loaded.
131
-
---@returnnumber reference to the Manifest that is currently loaded
132
-
functionresource.get_current_manifest() end
133
-
134
146
---Gets the text metrics from a font
135
147
---@paramurlhash the font to get the (unscaled) metrics from
136
148
---@paramtextstring text to measure
137
149
---@paramoptionstable A table containing parameters for the text. Supported entries:
138
150
---@returntable a table with the following fields:
139
151
functionresource.get_text_metrics(url, text, options) end
140
152
141
-
---Is any liveupdate data mounted and currently in use?
142
-
---This can be used to determine if a new manifest or zip file should be downloaded.
143
-
---@returnbool true if a liveupdate archive (any format) has been loaded
144
-
functionresource.is_using_liveupdate_data() end
153
+
---Gets texture info from a texture resource path or a texture handle
154
+
---@parampathhash|string|handle The path to the resource or a texture handle
155
+
---@returntable A table containing info about the texture:
156
+
functionresource.get_texture_info(path) end
145
157
146
158
---Loads the resource data for a specific resource.
147
159
---@parampathstring The path to the resource
@@ -201,36 +213,6 @@ function resource.set_sound(path, buffer) end
201
213
---@parambufferbuffer The buffer of precreated pixel data To update a cube map texture you need to pass in six times the amount of data via the buffer, since a cube map has six sides!
202
214
functionresource.set_texture(path, table, buffer) end
203
215
204
-
---Stores a zip file and uses it for live update content. The contents of the
205
-
---zip file will be verified against the manifest to ensure file integrity.
206
-
---It is possible to opt out of the resource verification using an option passed
207
-
---to this function.
208
-
---The path is stored in the (internal) live update location.
209
-
---@parampathstring the path to the original file on disc
210
-
---@paramcallbackfunction(self, status) the callback function executed after the storage has completed
211
-
---@paramoptionstable optional table with extra parameters. Supported entries:
212
-
functionresource.store_archive(path, callback, options) end
213
-
214
-
---Create a new manifest from a buffer. The created manifest is verified
215
-
---by ensuring that the manifest was signed using the bundled public/private
216
-
---key-pair during the bundle process and that the manifest supports the current
217
-
---running engine version. Once the manifest is verified it is stored on device.
218
-
---The next time the engine starts (or is rebooted) it will look for the stored
219
-
---manifest before loading resources. Storing a new manifest allows the
220
-
---developer to update the game, modify existing resources, or add new
221
-
---resources to the game through LiveUpdate.
222
-
---@parammanifest_bufferstring the binary data that represents the manifest
223
-
---@paramcallbackfunction(self, status) the callback function executed once the engine has attempted to store the manifest.
224
-
functionresource.store_manifest(manifest_buffer, callback) end
225
-
226
-
---add a resource to the data archive and runtime index. The resource will be verified
227
-
---internally before being added to the data archive.
228
-
---@parammanifest_referencenumber The manifest to check against.
229
-
---@paramdatastring The resource data that should be stored.
230
-
---@paramhexdigeststring The expected hash for the resource, retrieved through collectionproxy.missing_resources.
231
-
---@paramcallbackfunction(self, hexdigest, status) The callback function that is executed once the engine has been attempted to store the resource.
232
-
functionresource.store_resource(manifest_reference, data, hexdigest, callback) end
0 commit comments