<|start_filename|>.defold-api/system.lua<|end_filename|>
---System API documentation
---Functions and messages for using system resources, controlling the engine,
---error handling and debugging.
---@class sys
sys = {}
---network connected through other, non cellular, connection
sys.NETWORK_CONNECTED = nil
---network connected through mobile cellular
sys.NETWORK_CONNECTED_CELLULAR = nil
---no network connection found
sys.NETWORK_DISCONNECTED = nil
---Terminates the game application and reports the specified code to the OS.
---@param code number exit code to report to the OS, 0 means clean exit
function sys.exit(code) end

---Returns a table with application information for the requested app.
--- On iOS, the app_string is an url scheme for the app that is queried. Your
---game needs to list the schemes that are queried in an LSApplicationQueriesSchemes array
---in a custom "Info.plist".
--- On Android, the app_string is the package identifier for the app.
---@param app_string string platform specific string with application package or query, see above for details.
---@return table table with application information in the following fields:
function sys.get_application_info(app_string) end

---The path from which the application is run.
---@return string path to application executable
function sys.get_application_path() end

---Get config value from the game.project configuration file.
---In addition to the project file, configuration values can also be passed
---to the runtime as command line arguments with the --config argument.
---@param key string key to get value for. The syntax is SECTION.KEY
---@return string config value as a string. nil if the config key doesn't exists
function sys.get_config(key) end

---Get config value from the game.project configuration file with default value
---@param key string key to get value for. The syntax is SECTION.KEY
---@param default_value string default value to return if the value does not exist
---@return string config value as a string. default_value if the config key does not exist
function sys.get_config(key, default_value) end

--- Returns the current network connectivity status
---on mobile platforms.
---On desktop, this function always return sys.NETWORK_CONNECTED.
---@return constant network connectivity status:
function sys.get_connectivity() end

---Returns a table with engine information.
---@return table table with engine information in the following fields:
function sys.get_engine_info() end

---Returns an array of tables with information on network interfaces.
---@return table an array of tables. Each table entry contain the following fields:
function sys.get_ifaddrs() end

---The save-file path is operating system specific and is typically located under the user's home directory.
---@param application_id string user defined id of the application, which helps define the location of the save-file
---@param file_name string file-name to get path for
---@return string path to save-file
function sys.get_save_file(application_id, file_name) end

---Returns a table with system information.
---@return table table with system information in the following fields:
function sys.get_sys_info() end

---If the file exists, it must have been created by sys.save to be loaded.
---@param filename string file to read from
---@return table lua table, which is empty if the file could not be found
function sys.load(filename) end

---Loads a custom resource. Specify the full filename of the resource that you want
---to load. When loaded, the file data is returned as a string.
---If loading fails, the function returns nil plus the error message.
---In order for the engine to include custom resources in the build process, you need
---to specify them in the "custom_resources" key in your "game.project" settings file.
---You can specify single resource files or directories. If a directory is included
---in the resource list, all files and directories in that directory is recursively
---included:
---For example "main/data/,assets/level_data.json".
---@param filename string resource to load, full path
---@return string loaded data, or nil if the resource could not be loaded
---@return string the error message, or nil if no error occurred
function sys.load_resource(filename) end

---Open URL in default application, typically a browser
---@param url string url to open
---@param attributes table table with attributes target - string : Optional. Specifies the target attribute or the name of the window. The following values are supported: - _self - URL replaces the current page. This is default. - _blank - URL is loaded into a new window, or tab. - _parent - URL is loaded into the parent frame. - _top - URL replaces any framesets that may be loaded. - name - The name of the window (Note: the name does not specify the title of the new window).
---@return boolean a boolean indicating if the url could be opened or not
function sys.open_url(url, attributes) end

---Reboots the game engine with a specified set of arguments.
---Arguments will be translated into command line arguments. Calling reboot
---function is equivalent to starting the engine with the same arguments.
---On startup the engine reads configuration from "game.project" in the
---project root.
---@param arg1 string argument 1
---@param arg2 string argument 2
---@param arg3 string argument 3
---@param arg4 string argument 4
---@param arg5 string argument 5
---@param arg6 string argument 6
function sys.reboot(arg1, arg2, arg3, arg4, arg5, arg6) end

---The table can later be loaded by sys.load.
---Use sys.get_save_file to obtain a valid location for the file.
---Internally, this function uses a workspace buffer sized output file sized 512kb.
---This size reflects the output file size which must not exceed this limit.
---Additionally, the total number of rows that any one table may contain is limited to 65536
---(i.e. a 16 bit range). When tables are used to represent arrays, the values of
---keys are permitted to fall within a 32 bit range, supporting sparse arrays, however
---the limit on the total number of rows remains in effect.
---@param filename string file to write to
---@param table table lua table to save
---@return boolean a boolean indicating if the table could be saved or not
function sys.save(filename, table) end

---Sets the host that is used to check for network connectivity against.
---@param host string hostname to check against
function sys.set_connectivity_host(host) end

---Set the Lua error handler function.
---The error handler is a function which is called whenever a lua runtime error occurs.
---@param error_handler function(source, message, traceback) the function to be called on error
function sys.set_error_handler(error_handler) end

---Set game update-frequency (frame cap). This option is equivalent to display.update_frequency in
---the "game.project" settings but set in run-time. If Vsync checked in "game.project", the rate will
---be clamped to a swap interval that matches any detected main monitor refresh rate. If Vsync is
---unchecked the engine will try to respect the rate in software using timers. There is no
---guarantee that the frame cap will be achieved depending on platform specifics and hardware settings.
---@param frequency number target frequency. 60 for 60 fps
function sys.set_update_frequency(frequency) end

---Set the vsync swap interval. The interval with which to swap the front and back buffers
---in sync with vertical blanks (v-blank), the hardware event where the screen image is updated
---with data from the front buffer. A value of 1 swaps the buffers at every v-blank, a value of
---2 swaps the buffers every other v-blank and so on. A value of 0 disables waiting for v-blank
---before swapping the buffers. Default value is 1.
---When setting the swap interval to 0 and having vsync disabled in
---"game.project", the engine will try to respect the set frame cap value from
---"game.project" in software instead.
---This setting may be overridden by driver settings.
---@param swap_interval number target swap interval.
function sys.set_vsync_swap_interval(swap_interval) end




return sys

<|start_filename|>.defold-api/game_object.lua<|end_filename|>
---Game object API documentation
---Functions, core hooks, messages and constants for manipulation of
---game objects. The "go" namespace is accessible from game object script
---files.
---@class go
go = {}
---This is a callback-function, which is called by the engine when a script component is finalized (destroyed). It can
---be used to e.g. take some last action, report the finalization to other game object instances, delete spawned objects
---or release user input focus (see release_input_focus <>).
---@param self object reference to the script state to be used for storing data
function final(self) end

---in-back
go.EASING_INBACK = nil
---in-bounce
go.EASING_INBOUNCE = nil
---in-circlic
go.EASING_INCIRC = nil
---in-cubic
go.EASING_INCUBIC = nil
---in-elastic
go.EASING_INELASTIC = nil
---in-exponential
go.EASING_INEXPO = nil
---in-out-back
go.EASING_INOUTBACK = nil
---in-out-bounce
go.EASING_INOUTBOUNCE = nil
---in-out-circlic
go.EASING_INOUTCIRC = nil
---in-out-cubic
go.EASING_INOUTCUBIC = nil
---in-out-elastic
go.EASING_INOUTELASTIC = nil
---in-out-exponential
go.EASING_INOUTEXPO = nil
---in-out-quadratic
go.EASING_INOUTQUAD = nil
---in-out-quartic
go.EASING_INOUTQUART = nil
---in-out-quintic
go.EASING_INOUTQUINT = nil
---in-out-sine
go.EASING_INOUTSINE = nil
---in-quadratic
go.EASING_INQUAD = nil
---in-quartic
go.EASING_INQUART = nil
---in-quintic
go.EASING_INQUINT = nil
---in-sine
go.EASING_INSINE = nil
---linear interpolation
go.EASING_LINEAR = nil
---out-back
go.EASING_OUTBACK = nil
---out-bounce
go.EASING_OUTBOUNCE = nil
---out-circlic
go.EASING_OUTCIRC = nil
---out-cubic
go.EASING_OUTCUBIC = nil
---out-elastic
go.EASING_OUTELASTIC = nil
---out-exponential
go.EASING_OUTEXPO = nil
---out-in-back
go.EASING_OUTINBACK = nil
---out-in-bounce
go.EASING_OUTINBOUNCE = nil
---out-in-circlic
go.EASING_OUTINCIRC = nil
---out-in-cubic
go.EASING_OUTINCUBIC = nil
---out-in-elastic
go.EASING_OUTINELASTIC = nil
---out-in-exponential
go.EASING_OUTINEXPO = nil
---out-in-quadratic
go.EASING_OUTINQUAD = nil
---out-in-quartic
go.EASING_OUTINQUART = nil
---out-in-quintic
go.EASING_OUTINQUINT = nil
---out-in-sine
go.EASING_OUTINSINE = nil
---out-quadratic
go.EASING_OUTQUAD = nil
---out-quartic
go.EASING_OUTQUART = nil
---out-quintic
go.EASING_OUTQUINT = nil
---out-sine
go.EASING_OUTSINE = nil
---loop backward
go.PLAYBACK_LOOP_BACKWARD = nil
---loop forward
go.PLAYBACK_LOOP_FORWARD = nil
---ping pong loop
go.PLAYBACK_LOOP_PINGPONG = nil
---no playback
go.PLAYBACK_NONE = nil
---once backward
go.PLAYBACK_ONCE_BACKWARD = nil
---once forward
go.PLAYBACK_ONCE_FORWARD = nil
---once ping pong
go.PLAYBACK_ONCE_PINGPONG = nil
---This is only supported for numerical properties. If the node property is already being
---animated, that animation will be canceled and replaced by the new one.
---If a complete_function (lua function) is specified, that function will be called when the animation has completed.
---By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
--- If you call go.animate() from a game object's final() function,
---any passed complete_function will be ignored and never called upon animation completion.
---See the properties guide <> for which properties can be animated and the animation guide <> for how to animate them.
---@param url string|hash|url url of the game object or component having the property
---@param property string|hash id of the property to animate
---@param playback constant playback mode of the animation
---@param to number|vector3|vector4|quaternion target property value
---@param easing constant|vector easing to use during animation. Either specify a constant, see the animation guide <> for a complete list, or a vmath.vector with a curve
---@param duration number duration of the animation in seconds
---@param delay number delay before the animation starts in seconds
---@param complete_function function(self, url, property) optional function to call when the animation has completed
function go.animate(url, property, playback, to, easing, duration, delay, complete_function) end

---By calling this function, all stored animations of the given property will be canceled.
---See the properties guide <> for which properties can be animated and the animation guide <> for how to animate them.
---@param url string|hash|url url of the game object or component having the property
---@param property string|hash ide of the property to animate
function go.cancel_animations(url, property) end

---Delete one or more game objects identified by id. Deletion is asynchronous meaning that
---the game object(s) are scheduled for deletion which will happen at the end of the current
---frame. Note that game objects scheduled for deletion will be counted against
---max_instances in "game.project" until they are actually removed.
--- Deleting a game object containing a particle FX component emitting particles will not immediately stop the particle FX from emitting particles. You need to manually stop the particle FX using particlefx.stop().
--- Deleting a game object containing a sound component that is playing will not immediately stop the sound from playing. You need to manually stop the sound using sound.stop().
---@param id string|hash|url|table optional id or table of id's of the instance(s) to delete, the instance of the calling script is deleted by default
---@param recursive boolean optional boolean, set to true to recursively delete child hiearchy in child to parent order
function go.delete(id, recursive) end

---gets a named property of the specified game object or component
---@param url string|hash|url url of the game object or component having the property
---@param property string|hash id of the property to retrieve
---@return any the value of the specified property
function go.get(url, property) end

---Returns or constructs an instance identifier. The instance id is a hash
---of the absolute path to the instance.
---
---
--- * If path is specified, it can either be absolute or relative to the instance of the calling script.
---
--- * If path is not specified, the id of the game object instance the script is attached to will be returned.
---@param path string path of the instance for which to return the id
---@return hash instance id
function go.get_id(path) end

---Get the parent for a game object instance.
---@param id string|hash|url optional id of the game object instance to get parent for, defaults to the instance containing the calling script
---@return hash parent instance or nil
function go.get_parent(id) end

---The position is relative the parent (if any). Use go.get_world_position <> to retrieve the global world position.
---@param id string|hash|url optional id of the game object instance to get the position for, by default the instance of the calling script
---@return vector3 instance position
function go.get_position(id) end

---The rotation is relative to the parent (if any). Use go.get_world_rotation <> to retrieve the global world rotation.
---@param id string|hash|url optional id of the game object instance to get the rotation for, by default the instance of the calling script
---@return quaternion instance rotation
function go.get_rotation(id) end

---The scale is relative the parent (if any). Use go.get_world_scale <> to retrieve the global world 3D scale factor.
---@param id string|hash|url optional id of the game object instance to get the scale for, by default the instance of the calling script
---@return vector3 instance scale factor
function go.get_scale(id) end

---The uniform scale is relative the parent (if any). If the underlying scale vector is non-uniform the min element of the vector is returned as the uniform scale factor.
---@param id string|hash|url optional id of the game object instance to get the uniform scale for, by default the instance of the calling script
---@return number uniform instance scale factor
function go.get_scale_uniform(id) end

---The function will return the world position calculated at the end of the previous frame.
---Use go.get_position <> to retrieve the position relative to the parent.
---@param id string|hash|url optional id of the game object instance to get the world position for, by default the instance of the calling script
---@return vector3 instance world position
function go.get_world_position(id) end

---The function will return the world rotation calculated at the end of the previous frame.
---Use go.get_rotation <> to retrieve the rotation relative to the parent.
---@param id string|hash|url optional id of the game object instance to get the world rotation for, by default the instance of the calling script
---@return quaternion instance world rotation
function go.get_world_rotation(id) end

---The function will return the world 3D scale factor calculated at the end of the previous frame.
---Use go.get_scale <> to retrieve the 3D scale factor relative to the parent.
---This vector is derived by decomposing the transformation matrix and should be used with care.
---For most cases it should be fine to use go.get_world_scale_uniform <> instead.
---@param id string|hash|url optional id of the game object instance to get the world scale for, by default the instance of the calling script
---@return vector3 instance world 3D scale factor
function go.get_world_scale(id) end

---The function will return the world scale factor calculated at the end of the previous frame.
---Use go.get_scale_uniform <> to retrieve the scale factor relative to the parent.
---@param id string|hash|url optional id of the game object instance to get the world scale for, by default the instance of the calling script
---@return number instance world scale factor
function go.get_world_scale_uniform(id) end

---The function will return the world transform matrix calculated at the end of the previous frame.
---@param id string|hash|url optional id of the game object instance to get the world transform for, by default the instance of the calling script
---@return matrix4 instance world transform
function go.get_world_transform(id) end

---This function defines a property which can then be used in the script through the self-reference.
---The properties defined this way are automatically exposed in the editor in game objects and collections which use the script.
---Note that you can only use this function outside any callback-functions like init and update.
---@param name string the id of the property
---@param value number|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.
function go.property(name, value) end

---sets a named property of the specified game object or component, or a material constant
---@param url string|hash|url url of the game object or component having the property
---@param property string|hash id of the property to set
---@param value any the value to set
function go.set(url, property, value) end

---Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
---like a basic transformation hierarchy or scene graph. If no parent is specified, the instance will be detached from any parent and exist in world
---space.
---This function will generate a set_parent message. It is not until the message has been processed that the change actually takes effect. This
---typically happens later in the same frame or the beginning of the next frame. Refer to the manual to learn how messages are processed by the
---engine.
---@param id string|hash|url optional id of the game object instance to set parent for, defaults to the instance containing the calling script
---@param parent_id string|hash|url optional id of the new parent game object, defaults to detaching game object from its parent
---@param keep_world_transform boolean optional boolean, set to true to maintain the world transform when changing spaces. Defaults to false.
function go.set_parent(id, parent_id, keep_world_transform) end

---The position is relative to the parent (if any). The global world position cannot be manually set.
---@param position vector3 position to set
---@param id string|hash|url optional id of the game object instance to set the position for, by default the instance of the calling script
function go.set_position(position, id) end

---The rotation is relative to the parent (if any). The global world rotation cannot be manually set.
---@param rotation quaternion rotation to set
---@param id string|hash|url optional id of the game object instance to get the rotation for, by default the instance of the calling script
function go.set_rotation(rotation, id) end

---The scale factor is relative to the parent (if any). The global world scale factor cannot be manually set.
--- Physics are currently not affected when setting scale from this function.
---@param scale number|vector3 vector or uniform scale factor, must be greater than 0
---@param id string|hash|url optional id of the game object instance to get the scale for, by default the instance of the calling script
function go.set_scale(scale, id) end

---This is a callback-function, which is called by the engine when a script component is initialized. It can be used
---to set the initial state of the script.
---@param self object reference to the script state to be used for storing data
function init(self) end

---This is a callback-function, which is called by the engine when user input is sent to the game object instance of the script.
---It can be used to take action on the input, e.g. move the instance according to the input.
---For an instance to obtain user input, it must first acquire input focus
---through the message acquire_input_focus.
---Any instance that has obtained input will be put on top of an
---input stack. Input is sent to all listeners on the stack until the
---end of stack is reached, or a listener returns true
---to signal that it wants input to be consumed.
---See the documentation of acquire_input_focus <> for more
---information.
---The action parameter is a table containing data about the input mapped to the
---action_id.
---For mapped actions it specifies the value of the input and if it was just pressed or released.
---Actions are mapped to input in an input_binding-file.
---Mouse movement is specifically handled and uses nil as its action_id.
---The action only contains positional parameters in this case, such as x and y of the pointer.
---Here is a brief description of the available table fields:
---
---Field                         Description
---value                         The amount of input given by the user. This is usually 1 for buttons and 0-1 for analogue inputs. This is not present for mouse movement.
---pressed                       If the input was pressed this frame. This is not present for mouse movement.
---released                      If the input was released this frame. This is not present for mouse movement.
---repeated                      If the input was repeated this frame. This is similar to how a key on a keyboard is repeated when you hold it down. This is not present for mouse movement.
---x                             The x value of a pointer device, if present.
---y                             The y value of a pointer device, if present.
---screen_x                      The screen space x value of a pointer device, if present.
---screen_y                      The screen space y value of a pointer device, if present.
---dx                            The change in x value of a pointer device, if present.
---dy                            The change in y value of a pointer device, if present.
---screen_dx                     The change in screen space x value of a pointer device, if present.
---screen_dy                     The change in screen space y value of a pointer device, if present.
---gamepad                       The index of the gamepad device that provided the input.
---touch                         List of touch input, one element per finger, if present. See table below about touch input
---Touch input table:
---
---Field                         Description
---id                            A number identifying the touch input during its duration.
---pressed                       True if the finger was pressed this frame.
---released                      True if the finger was released this frame.
---tap_count                     Number of taps, one for single, two for double-tap, etc
---x                             The x touch location.
---y                             The y touch location.
---dx                            The change in x value.
---dy                            The change in y value.
---acc_x                         Accelerometer x value (if present).
---acc_y                         Accelerometer y value (if present).
---acc_z                         Accelerometer z value (if present).
---@param self object reference to the script state to be used for storing data
---@param action_id hash id of the received input action, as mapped in the input_binding-file
---@param action table a table containing the input data, see above for a description
---@return boolean optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
function on_input(self, action_id, action) end

---This is a callback-function, which is called by the engine whenever a message has been sent to the script component.
---It can be used to take action on the message, e.g. send a response back to the sender of the message.
---The message parameter is a table containing the message data. If the message is sent from the engine, the
---documentation of the message specifies which data is supplied.
---@param self object reference to the script state to be used for storing data
---@param message_id hash id of the received message
---@param message table a table containing the message data
---@param sender url address of the sender
function on_message(self, message_id, message, sender) end

---This is a callback-function, which is called by the engine when the script component is reloaded, e.g. from the editor.
---It can be used for live development, e.g. to tweak constants or set up the state properly for the instance.
---@param self object reference to the script state to be used for storing data
function on_reload(self) end

---This is a callback-function, which is called by the engine every frame to update the state of a script component.
---It can be used to perform any kind of game related tasks, e.g. moving the game object instance.
---@param self object reference to the script state to be used for storing data
---@param dt number the time-step of the frame update
function update(self, dt) end




return go

<|start_filename|>.defold-api/collection_factory.lua<|end_filename|>
---Collection factory API documentation
---Functions for controlling collection factory components which are
---used to dynamically spawn collections into the runtime.
---@class collectionfactory
collectionfactory = {}
---loaded
collectionfactory.STATUS_LOADED = nil
---loading
collectionfactory.STATUS_LOADING = nil
---unloaded
collectionfactory.STATUS_UNLOADED = nil
---The URL identifies the collectionfactory component that should do the spawning.
---Spawning is instant, but spawned game objects get their first update calls the following frame. The supplied parameters for position, rotation and scale
---will be applied to the whole collection when spawned.
---Script properties in the created game objects can be overridden through
---a properties-parameter table. The table should contain game object ids
---(hash) as keys and property tables as values to be used when initiating each
---spawned game object.
---See go.property for more information on script properties.
---The function returns a table that contains a key for each game object
---id (hash), as addressed if the collection file was top level, and the
---corresponding spawned instance id (hash) as value with a unique path
---prefix added to each instance.
--- Calling collectionfactory.create <> create on a collection factory that is marked as dynamic without having loaded resources
---using collectionfactory.load <> will synchronously load and create resources which may affect application performance.
---@param url string|hash|url the collection factory component to be used
---@param position vector3 position to assign to the newly spawned collection
---@param rotation quaternion rotation to assign to the newly spawned collection
---@param properties table table of script properties to propagate to any new game object instances
---@param scale number uniform scaling to apply to the newly spawned collection (must be greater than 0).
---@return table a table mapping the id:s from the collection to the new instance id:s
function collectionfactory.create(url, position, rotation, properties, scale) end

---This returns status of the collection factory.
---Calling this function when the factory is not marked as dynamic loading always returns COMP_COLLECTION_FACTORY_STATUS_LOADED.
---@param url string|hash|url the collection factory component to get status from
---@return constant status of the collection factory component
function collectionfactory.get_status(url) end

---Resources loaded are referenced by the collection factory component until the existing (parent) collection is destroyed or collectionfactory.unload is called.
---Calling this function when the factory is not marked as dynamic loading does nothing.
---@param url string|hash|url the collection factory component to load
---@param complete_function function(self, url, result)) function to call when resources are loaded.
function collectionfactory.load(url, complete_function) end

---This decreases the reference count for each resource loaded with collectionfactory.load. If reference is zero, the resource is destroyed.
---Calling this function when the factory is not marked as dynamic loading does nothing.
---@param url string|hash|url the collection factory component to unload
function collectionfactory.unload(url) end




return collectionfactory

<|start_filename|>.defold-api/image.lua<|end_filename|>
---Image API documentation
---Functions for creating image objects.
---@class image
image = {}
---luminance image type
image.TYPE_LUMINANCE = nil
---RGB image type
image.TYPE_RGB = nil
---RGBA image type
image.TYPE_RGBA = nil
---Load image (PNG or JPEG) from buffer.
---@param buffer string image data buffer
---@param premult boolean optional flag if alpha should be premultiplied. Defaults to false
---@return table object or nil if loading fails. The object is a table with the following fields:
function image.load(buffer, premult) end




return image

<|start_filename|>.defold-api/sprite.lua<|end_filename|>
---Sprite API documentation
---Sprite API documentation
---@class sprite
sprite = {}
---Play an animation on a sprite component from its tile set
---An optional completion callback function can be provided that will be called when
---the animation has completed playing. If no function is provided,
---a animation_done <> message is sent to the script that started the animation.
---@param url string|hash|url the sprite that should play the animation
---@param id  hash name hash of the animation to play
---@param complete_function function(self, message_id, message, sender)) function to call when the animation has completed.
---@param play_properties table optional table with properties:
function sprite.play_flipbook(url, id, complete_function, play_properties) end

---Sets horizontal flipping of the provided sprite's animations.
---The sprite is identified by its URL.
---If the currently playing animation is flipped by default, flipping it again will make it appear like the original texture.
---@param url string|hash|url the sprite that should flip its animations
---@param flip boolean true if the sprite should flip its animations, false if not
function sprite.set_hflip(url, flip) end

---Sets vertical flipping of the provided sprite's animations.
---The sprite is identified by its URL.
---If the currently playing animation is flipped by default, flipping it again will make it appear like the original texture.
---@param url string|hash|url the sprite that should flip its animations
---@param flip boolean true if the sprite should flip its animations, false if not
function sprite.set_vflip(url, flip) end




return sprite

<|start_filename|>.defold-api/render.lua<|end_filename|>
---Rendering API documentation
---Rendering functions, messages and constants. The "render" namespace is
---accessible only from render scripts.
---The rendering API is built on top of OpenGL ES 2.0, is a subset of the
---OpenGL computer graphics rendering API for rendering 2D and 3D computer
---graphics. OpenGL ES 2.0 is supported on all our target platforms.
--- It is possible to create materials and write shaders that
---require features not in OpenGL ES 2.0, but those will not work cross platform.
---@class render
render = {}
render.BLEND_CONSTANT_ALPHA = nil
render.BLEND_CONSTANT_COLOR = nil
render.BLEND_DST_ALPHA = nil
render.BLEND_DST_COLOR = nil
render.BLEND_ONE = nil
render.BLEND_ONE_MINUS_CONSTANT_ALPHA = nil
render.BLEND_ONE_MINUS_CONSTANT_COLOR = nil
render.BLEND_ONE_MINUS_DST_ALPHA = nil
render.BLEND_ONE_MINUS_DST_COLOR = nil
render.BLEND_ONE_MINUS_SRC_ALPHA = nil
render.BLEND_ONE_MINUS_SRC_COLOR = nil
render.BLEND_SRC_ALPHA = nil
render.BLEND_SRC_ALPHA_SATURATE = nil
render.BLEND_SRC_COLOR = nil
render.BLEND_ZERO = nil
render.BUFFER_COLOR_BIT = nil
render.BUFFER_DEPTH_BIT = nil
render.BUFFER_STENCIL_BIT = nil
render.COMPARE_FUNC_ALWAYS = nil
render.COMPARE_FUNC_EQUAL = nil
render.COMPARE_FUNC_GEQUAL = nil
render.COMPARE_FUNC_GREATER = nil
render.COMPARE_FUNC_LEQUAL = nil
render.COMPARE_FUNC_LESS = nil
render.COMPARE_FUNC_NEVER = nil
render.COMPARE_FUNC_NOTEQUAL = nil
render.FACE_BACK = nil
render.FACE_FRONT = nil
render.FACE_FRONT_AND_BACK = nil
render.FILTER_LINEAR = nil
render.FILTER_NEAREST = nil
render.FORMAT_DEPTH = nil
render.FORMAT_LUMINANCE = nil
render.FORMAT_RGB = nil
render.FORMAT_RGBA = nil
render.FORMAT_RGBA_DXT1 = nil
render.FORMAT_RGBA_DXT3 = nil
render.FORMAT_RGBA_DXT5 = nil
render.FORMAT_RGB_DXT1 = nil
render.FORMAT_STENCIL = nil
render.RENDER_TARGET_DEFAULT = nil
render.STATE_BLEND = nil
render.STATE_CULL_FACE = nil
render.STATE_DEPTH_TEST = nil
render.STATE_POLYGON_OFFSET_FILL = nil
render.STATE_STENCIL_TEST = nil
render.STENCIL_OP_DECR = nil
render.STENCIL_OP_DECR_WRAP = nil
render.STENCIL_OP_INCR = nil
render.STENCIL_OP_INCR_WRAP = nil
render.STENCIL_OP_INVERT = nil
render.STENCIL_OP_KEEP = nil
render.STENCIL_OP_REPLACE = nil
render.STENCIL_OP_ZERO = nil
render.WRAP_CLAMP_TO_BORDER = nil
render.WRAP_CLAMP_TO_EDGE = nil
render.WRAP_MIRRORED_REPEAT = nil
render.WRAP_REPEAT = nil
---Clear buffers in the currently enabled render target with specified value.
---@param buffers table table with keys specifying which buffers to clear and values set to clear values. Available keys are:
function render.clear(buffers) end

---Constant buffers are used to set shader program variables and are optionally passed to the render.draw() function. The buffer's constant elements can be indexed like an ordinary Lua table, but you can't iterate over them with pairs() or ipairs().
---@return constant_buffer new constant buffer
function render.constant_buffer() end

---Deletes a previously created render target.
---@param render_target render_target render target to delete
function render.delete_render_target(render_target) end

---If a material is currently enabled, disable it.
---The name of the material must be specified in the ".render" resource set
---in the "game.project" setting.
function render.disable_material() end

---Disables a render state.
---@param state constant state to disable
function render.disable_state(state) end

---Disables a texture unit for a render target that has previourly been enabled.
---@param unit number texture unit to disable
function render.disable_texture(unit) end

---Draws all objects that match a specified predicate. An optional constant buffer can be
---provided to override the default constants. If no constants buffer is provided, a default
---system constants buffer is used containing constants as defined in materials and set through
---go.set <> (or particlefx.set_constant <>) on visual components.
---@param predicate predicate predicate to draw for
---@param constants constant_buffer optional constants to use while rendering
function render.draw(predicate, constants) end

---Draws all 3d debug graphics such as lines drawn with "draw_line" messages and physics visualization.
function render.draw_debug3d() end

---If another material was already enabled, it will be automatically disabled
---and the specified material is used instead.
---The name of the material must be specified in the ".render" resource set
---in the "game.project" setting.
---@param material_id string|hash material id to enable
function render.enable_material(material_id) end

---Enables a particular render state. The state will be enabled until disabled.
---@param state constant state to enable
function render.enable_state(state) end

---Sets the specified render target's specified buffer to be
---used as texture with the specified unit.
---A material shader can then use the texture to sample from.
---@param unit number texture unit to enable texture for
---@param render_target render_target render target from which to enable the specified texture unit
---@param buffer_type constant buffer type from which to enable the texture
function render.enable_texture(unit, render_target, buffer_type) end

---Returns the logical window height that is set in the "game.project" settings.
---Note that the actual window pixel size can change, either by device constraints
---or user input.
---@return number specified window height
function render.get_height() end

---Returns the specified buffer height from a render target.
---@param render_target render_target render target from which to retrieve the buffer height
---@param buffer_type constant which type of buffer to retrieve the height from
---@return number the height of the render target buffer texture
function render.get_render_target_height(render_target, buffer_type) end

---Returns the specified buffer width from a render target.
---@param render_target render_target render target from which to retrieve the buffer width
---@param buffer_type constant which type of buffer to retrieve the width from
---@return number the width of the render target buffer texture
function render.get_render_target_width(render_target, buffer_type) end

---Returns the logical window width that is set in the "game.project" settings.
---Note that the actual window pixel size can change, either by device constraints
---or user input.
---@return number specified window width (number)
function render.get_width() end

---Returns the actual physical window height.
---Note that this value might differ from the logical height that is set in the
---"game.project" settings.
---@return number actual window height
function render.get_window_height() end

---Returns the actual physical window width.
---Note that this value might differ from the logical width that is set in the
---"game.project" settings.
---@return number actual window width
function render.get_window_width() end

---This function returns a new render predicate for objects with materials matching
---the provided material tags. The provided tags are combined into a bit mask
---for the predicate. If multiple tags are provided, the predicate matches materials
---with all tags ANDed together.
---The current limit to the number of tags that can be defined is 64.
---@param tags table table of tags that the predicate should match. The tags can be of either hash or string type
---@return predicate new predicate
function render.predicate(tags) end

---Creates a new render target according to the supplied
---specification table.
---The table should contain keys specifying which buffers should be created
---with what parameters. Each buffer key should have a table value consisting
---of parameters. The following parameter keys are available:
---
---Key                           Values
---format                        render.FORMAT_LUMINANCErender.FORMAT_RGBrender.FORMAT_RGBA render.FORMAT_RGB_DXT1render.FORMAT_RGBA_DXT1render.FORMAT_RGBA_DXT3 render.FORMAT_RGBA_DXT5render.FORMAT_DEPTHrender.FORMAT_STENCIL
---width                         number
---height                        number
---min_filter                    render.FILTER_LINEARrender.FILTER_NEAREST
---mag_filter                    render.FILTER_LINEARrender.FILTER_NEAREST
---u_wrap                        render.WRAP_CLAMP_TO_BORDERrender.WRAP_CLAMP_TO_EDGErender.WRAP_MIRRORED_REPEATrender.WRAP_REPEAT
---v_wrap                        render.WRAP_CLAMP_TO_BORDERrender.WRAP_CLAMP_TO_EDGErender.WRAP_MIRRORED_REPEATrender.WRAP_REPEAT
---@param name string render target name
---@param parameters table table of buffer parameters, see the description for available keys and values
---@return render_target new render target
function render.render_target(name, parameters) end

---Specifies the arithmetic used when computing pixel values that are written to the frame
---buffer. In RGBA mode, pixels can be drawn using a function that blends the source RGBA
---pixel values with the destination pixel values already in the frame buffer.
---Blending is initially disabled.
---source_factor specifies which method is used to scale the source color components.
---destination_factor specifies which method is used to scale the destination color
---components.
---Source color components are referred to as (Rs,Gs,Bs,As).
---Destination color components are referred to as (Rd,Gd,Bd,Ad).
---The color specified by setting the blendcolor is referred to as (Rc,Gc,Bc,Ac).
---The source scale factor is referred to as (sR,sG,sB,sA).
---The destination scale factor is referred to as (dR,dG,dB,dA).
---The color values have integer values between 0 and (kR,kG,kB,kA), where kc = 2mc - 1 and mc is the number of bitplanes for that color. I.e for 8 bit color depth, color values are between 0 and 255.
---Available factor constants and corresponding scale factors:
---
---Factor constant               Scale factor (fR,fG,fB,fA)
---render.BLEND_ZERO             (0,0,0,0)
---render.BLEND_ONE              (1,1,1,1)
---render.BLEND_SRC_COLOR        (Rs/kR,Gs/kG,Bs/kB,As/kA)
---render.BLEND_ONE_MINUS_SRC_COLOR(1,1,1,1) - (Rs/kR,Gs/kG,Bs/kB,As/kA)
---render.BLEND_DST_COLOR        (Rd/kR,Gd/kG,Bd/kB,Ad/kA)
---render.BLEND_ONE_MINUS_DST_COLOR(1,1,1,1) - (Rd/kR,Gd/kG,Bd/kB,Ad/kA)
---render.BLEND_SRC_ALPHA        (As/kA,As/kA,As/kA,As/kA)
---render.BLEND_ONE_MINUS_SRC_ALPHA(1,1,1,1) - (As/kA,As/kA,As/kA,As/kA)
---render.BLEND_DST_ALPHA        (Ad/kA,Ad/kA,Ad/kA,Ad/kA)
---render.BLEND_ONE_MINUS_DST_ALPHA(1,1,1,1) - (Ad/kA,Ad/kA,Ad/kA,Ad/kA)
---render.BLEND_CONSTANT_COLOR   (Rc,Gc,Bc,Ac)
---render.BLEND_ONE_MINUS_CONSTANT_COLOR(1,1,1,1) - (Rc,Gc,Bc,Ac)
---render.BLEND_CONSTANT_ALPHA   (Ac,Ac,Ac,Ac)
---render.BLEND_ONE_MINUS_CONSTANT_ALPHA(1,1,1,1) - (Ac,Ac,Ac,Ac)
---render.BLEND_SRC_ALPHA_SATURATE(i,i,i,1) where i = min(As, kA - Ad) /kA
---The blended RGBA values of a pixel comes from the following equations:
---
---
--- * Rd = min(kR, Rs * sR + Rd * dR)
---
--- * Gd = min(kG, Gs * sG + Gd * dG)
---
--- * Bd = min(kB, Bs * sB + Bd * dB)
---
--- * Ad = min(kA, As * sA + Ad * dA)
---
---Blend function (render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA) is useful for
---drawing with transparency when the drawn objects are sorted from farthest to nearest.
---It is also useful for drawing antialiased points and lines in arbitrary order.
---@param source_factor constant source factor
---@param destination_factor constant destination factor
function render.set_blend_func(source_factor, destination_factor) end

---Specifies whether the individual color components in the frame buffer is enabled for writing (true) or disabled (false). For example, if blue is false, nothing is written to the blue component of any pixel in any of the color buffers, regardless of the drawing operation attempted. Note that writing are either enabled or disabled for entire color components, not the individual bits of a component.
---The component masks are all initially true.
---@param red boolean red mask
---@param green boolean green mask
---@param blue boolean blue mask
---@param alpha boolean alpha mask
function render.set_color_mask(red, green, blue, alpha) end

---Specifies whether front- or back-facing polygons can be culled
---when polygon culling is enabled. Polygon culling is initially disabled.
---If mode is render.FACE_FRONT_AND_BACK, no polygons are drawn, but other
---primitives such as points and lines are drawn. The initial value for
---face_type is render.FACE_BACK.
---@param face_type constant face type
function render.set_cull_face(face_type) end

---Specifies the function that should be used to compare each incoming pixel
---depth value with the value present in the depth buffer.
---The comparison is performed only if depth testing is enabled and specifies
---the conditions under which a pixel will be drawn.
---Function constants:
---
---
--- * render.COMPARE_FUNC_NEVER (never passes)
---
--- * render.COMPARE_FUNC_LESS (passes if the incoming depth value is less than the stored value)
---
--- * render.COMPARE_FUNC_LEQUAL (passes if the incoming depth value is less than or equal to the stored value)
---
--- * render.COMPARE_FUNC_GREATER (passes if the incoming depth value is greater than the stored value)
---
--- * render.COMPARE_FUNC_GEQUAL (passes if the incoming depth value is greater than or equal to the stored value)
---
--- * render.COMPARE_FUNC_EQUAL (passes if the incoming depth value is equal to the stored value)
---
--- * render.COMPARE_FUNC_NOTEQUAL (passes if the incoming depth value is not equal to the stored value)
---
--- * render.COMPARE_FUNC_ALWAYS (always passes)
---
---The depth function is initially set to render.COMPARE_FUNC_LESS.
---@param func constant depth test function, see the description for available values
function render.set_depth_func(func) end

---Specifies whether the depth buffer is enabled for writing. The supplied mask governs
---if depth buffer writing is enabled (true) or disabled (false).
---The mask is initially true.
---@param depth boolean depth mask
function render.set_depth_mask(depth) end

---Sets the scale and units used to calculate depth values.
---If render.STATE_POLYGON_OFFSET_FILL is enabled, each fragment's depth value
---is offset from its interpolated value (depending on the depth value of the
---appropriate vertices). Polygon offset can be used when drawing decals, rendering
---hidden-line images etc.
---factor specifies a scale factor that is used to create a variable depth
---offset for each polygon. The initial value is 0.
---units is multiplied by an implementation-specific value to create a
---constant depth offset. The initial value is 0.
---The value of the offset is computed as factor × DZ + r × units
---DZ is a measurement of the depth slope of the polygon which is the change in z (depth)
---values divided by the change in either x or y coordinates, as you traverse a polygon.
---The depth values are in window coordinates, clamped to the range [0, 1].
---r is the smallest value that is guaranteed to produce a resolvable difference.
---It's value is an implementation-specific constant.
---The offset is added before the depth test is performed and before the
---value is written into the depth buffer.
---@param factor number polygon offset factor
---@param units number polygon offset units
function render.set_polygon_offset(factor, units) end

---Sets the projection matrix to use when rendering.
---@param matrix matrix4 projection matrix
function render.set_projection(matrix) end

---Sets a render target. Subsequent draw operations will be to the
---render target until it is replaced by a subsequent call to set_render_target.
---@param render_target render_target render target to set. render.RENDER_TARGET_DEFAULT to set the default render target
---@param options table optional table with behaviour parameters
function render.set_render_target(render_target, options) end

---sets the render target size
---@param render_target render_target render target to set size for
---@param width number new render target width
---@param height number new render target height
function render.set_render_target_size(render_target, width, height) end

---Stenciling is similar to depth-buffering as it enables and disables drawing on a
---per-pixel basis. First, GL drawing primitives are drawn into the stencil planes.
---Second, geometry and images are rendered but using the stencil planes to mask out
---where to draw.
---The stencil test discards a pixel based on the outcome of a comparison between the
---reference value ref and the corresponding value in the stencil buffer.
---func specifies the comparison function. See the table below for values.
---The initial value is render.COMPARE_FUNC_ALWAYS.
---ref specifies the reference value for the stencil test. The value is clamped to
---the range [0, 2n-1], where n is the number of bitplanes in the stencil buffer.
---The initial value is 0.
---mask is ANDed with both the reference value and the stored stencil value when the test
---is done. The initial value is all 1's.
---Function constant:
---
---
--- * render.COMPARE_FUNC_NEVER (never passes)
---
--- * render.COMPARE_FUNC_LESS (passes if (ref & mask) < (stencil & mask))
---
--- * render.COMPARE_FUNC_LEQUAL (passes if (ref & mask) <= (stencil & mask))
---
--- * render.COMPARE_FUNC_GREATER (passes if (ref & mask) > (stencil & mask))
---
--- * render.COMPARE_FUNC_GEQUAL (passes if (ref & mask) >= (stencil & mask))
---
--- * render.COMPARE_FUNC_EQUAL (passes if (ref & mask) = (stencil & mask))
---
--- * render.COMPARE_FUNC_NOTEQUAL (passes if (ref & mask) != (stencil & mask))
---
--- * render.COMPARE_FUNC_ALWAYS (always passes)
---@param func constant stencil test function, see the description for available values
---@param ref number reference value for the stencil test
---@param mask number mask that is ANDed with both the reference value and the stored stencil value when the test is done
function render.set_stencil_func(func, ref, mask) end

---The stencil mask controls the writing of individual bits in the stencil buffer.
---The least significant n bits of the parameter mask, where n is the number of
---bits in the stencil buffer, specify the mask.
---Where a 1 bit appears in the mask, the corresponding
---bit in the stencil buffer can be written. Where a 0 bit appears in the mask,
---the corresponding bit in the stencil buffer is never written.
---The mask is initially all 1's.
---@param mask number stencil mask
function render.set_stencil_mask(mask) end

---The stencil test discards a pixel based on the outcome of a comparison between the
---reference value ref and the corresponding value in the stencil buffer.
---To control the test, call render.set_stencil_func <>.
---This function takes three arguments that control what happens to the stored stencil
---value while stenciling is enabled. If the stencil test fails, no change is made to the
---pixel's color or depth buffers, and sfail specifies what happens to the stencil buffer
---contents.
---Operator constants:
---
---
--- * render.STENCIL_OP_KEEP (keeps the current value)
---
--- * render.STENCIL_OP_ZERO (sets the stencil buffer value to 0)
---
--- * render.STENCIL_OP_REPLACE (sets the stencil buffer value to ref, as specified by render.set_stencil_func <>)
---
--- * render.STENCIL_OP_INCR (increments the stencil buffer value and clamp to the maximum representable unsigned value)
---
--- * render.STENCIL_OP_INCR_WRAP (increments the stencil buffer value and wrap to zero when incrementing the maximum representable unsigned value)
---
--- * render.STENCIL_OP_DECR (decrements the current stencil buffer value and clamp to 0)
---
--- * render.STENCIL_OP_DECR_WRAP (decrements the current stencil buffer value and wrap to the maximum representable unsigned value when decrementing zero)
---
--- * render.STENCIL_OP_INVERT (bitwise inverts the current stencil buffer value)
---
---dppass and dpfail specify the stencil buffer actions depending on whether subsequent
---depth buffer tests succeed (dppass) or fail (dpfail).
---The initial value for all operators is render.STENCIL_OP_KEEP.
---@param sfail constant action to take when the stencil test fails
---@param dpfail constant the stencil action when the stencil test passes
---@param dppass constant the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled
function render.set_stencil_op(sfail, dpfail, dppass) end

---Sets the view matrix to use when rendering.
---@param matrix matrix4 view matrix to set
function render.set_view(matrix) end

---Set the render viewport to the specified rectangle.
---@param x number left corner
---@param y number bottom corner
---@param width number viewport width
---@param height number viewport height
function render.set_viewport(x, y, width, height) end




return render

<|start_filename|>.defold-api/profiler.lua<|end_filename|>
---Profiler API documentation
---Functions for getting profiling data in runtime.
---More detailed profiling <https://www.defold.com/manuals/profiling/> and debugging <http://www.defold.com/manuals/debugging/> information available in the manuals.
---@class profiler
profiler = {}
---pause on current frame
profiler.MODE_PAUSE = nil
---start recording
profiler.MODE_RECORD = nil
---continously show latest frame
profiler.MODE_RUN = nil
---pause at peak frame
profiler.MODE_SHOW_PEAK_FRAME = nil
---show full profiler ui
profiler.VIEW_MODE_FULL = nil
---show mimimal profiler ui
profiler.VIEW_MODE_MINIMIZED = nil
---Creates and shows or hides and destroys the on-sceen profiler ui
---The profiler is a real-time tool that shows the numbers of milliseconds spent
---in each scope per frame as well as counters. The profiler is very useful for
---tracking down performance and resource problems.
---@param enabled boolean true to enable, false to disable
function profiler.enable_ui(enabled) end

---Get the percent of CPU usage by the application, as reported by the OS.
--- This function is not available on  HTML5.
---For some platforms ( Android,  Linux and  Windows), this information is only available
---by default in the debug version of the engine. It can be enabled in release version as well
---by checking track_cpu under profiler in the game.project file.
---(This means that the engine will sample the CPU usage in intervalls during execution even in release mode.)
---@return number of CPU used by the application
function profiler.get_cpu_usage() end

---Get the amount of memory used (resident/working set) by the application in bytes, as reported by the OS.
--- This function is not available on  HTML5.
---The values are gathered from internal OS functions which correspond to the following;
---
---OS                            Value
--- iOS MacOSAndrod Linux <https://en.wikipedia.org/wiki/Resident_set_size>        Resident memory
--- Windows <https://en.wikipedia.org/wiki/Working_set>                      Working set
--- HTML5                         Not available
---@return number used by the application
function profiler.get_memory_usage() end

---Get the number of recorded frames in the on-screen profiler ui recording buffer
---@return number the number of recorded frames, zero if on-screen profiler is disabled
function profiler.recorded_frame_count() end

---Set the on-screen profile mode - run, pause, record or show peak frame
---@param mode constant the mode to set the ui profiler in
function profiler.set_ui_mode(mode) end

---Set the on-screen profile view mode - minimized or expanded
---@param mode constant the view mode to set the ui profiler in
function profiler.set_ui_view_mode(mode) end

---Shows or hides the time the engine waits for vsync in the on-screen profiler
---Each frame the engine waits for vsync and depending on your vsync settings and how much time
---your game logic takes this time can dwarf the time in the game logic making it hard to
---see details in the on-screen profiler graph and lists.
---Also, by hiding this the FPS times in the header show the time spent each time excuding the
---time spent waiting for vsync. This shows you how long time your game is spending actively
---working each frame.
---This setting also effects the display of recorded frames but does not affect the actual
---recorded frames so it is possible to toggle this on and off when viewing recorded frames.
---By default the vsync wait times is displayed in the profiler.
---@param visible boolean true to include it in the display, false to hide it.
function profiler.set_ui_vsync_wait_visible(visible) end

---Pauses and displays a frame from the recording buffer in the on-screen profiler ui
---The frame to show can either be an absolute frame or a relative frame to the current frame.
---@param frame_index table a table where you specify one of the following parameters:
function profiler.view_recorded_frame(frame_index) end




return profiler

<|start_filename|>.defold-api/window.lua<|end_filename|>
---Window API documentation
---Functions and constants to access the window, window event listeners
---and screen dimming.
---@class window
window = {}
---dimming mode off
window.DIMMING_OFF = nil
---dimming mode on
window.DIMMING_ON = nil
---dimming mode unknown
window.DIMMING_UNKNOWN = nil
---deiconified window event
window.WINDOW_EVENT_DEICONIFIED = nil
---focus gained window event
window.WINDOW_EVENT_FOCUS_GAINED = nil
---focus lost window event
window.WINDOW_EVENT_FOCUS_LOST = nil
---iconify window event
window.WINDOW_EVENT_ICONFIED = nil
---resized window event
window.WINDOW_EVENT_RESIZED = nil
--- Returns the current dimming mode set on a mobile device.
---The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction.
---On platforms that does not support dimming, window.DIMMING_UNKNOWN is always returned.
---@return constant The mode for screen dimming
function window.get_dim_mode() end

---This returns the current window size (width and height).
---@return number The window width
---@return number The window height
function window.get_size() end

--- Sets the dimming mode on a mobile device.
---The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction. The dimming mode will only affect the mobile device while the game is in focus on the device, but not when the game is running in the background.
---This function has no effect on platforms that does not support dimming.
---@param mode constant The mode for screen dimming
function window.set_dim_mode(mode) end

---Sets a window event listener.
---@param callback function(self, event, data) A callback which receives info about window events. Pass an empty function or nil if you no longer wish to receive callbacks.
function window.set_listener(callback) end




return window

<|start_filename|>.defold-api/collision_object.lua<|end_filename|>
---Collision object physics API documentation
---Collision object physics API documentation
---@class physics
physics = {}
---fixed joint type
physics.JOINT_TYPE_FIXED = nil
---hinge joint type
physics.JOINT_TYPE_HINGE = nil
---slider joint type
physics.JOINT_TYPE_SLIDER = nil
---spring joint type
physics.JOINT_TYPE_SPRING = nil
---weld joint type
physics.JOINT_TYPE_WELD = nil
---Create a physics joint between two collision object components.
---Note: Currently only supported in 2D physics.
---@param joint_type number the joint type
---@param collisionobject_a string|hash|url first collision object
---@param joint_id string|hash id of the joint
---@param position_a vector3 local position where to attach the joint on the first collision object
---@param collisionobject_b string|hash|url second collision object
---@param position_b vector3 local position where to attach the joint on the second collision object
---@param properties table optional joint specific properties table See each joint type for possible properties field. The one field that is accepted for all joint types is: - boolean collide_connected: Set this flag to true if the attached bodies should collide.
function physics.create_joint(joint_type, collisionobject_a, joint_id, position_a, collisionobject_b, position_b, properties) end

---Destroy an already physics joint. The joint has to be created before a
---destroy can be issued.
---Note: Currently only supported in 2D physics.
---@param collisionobject string|hash|url collision object where the joint exist
---@param joint_id string|hash id of the joint
function physics.destroy_joint(collisionobject, joint_id) end

---Get the gravity in runtime. The gravity returned is not global, it will return
---the gravity for the collection that the function is called from.
---Note: For 2D physics the z component will always be zero.
---@return vector3 gravity vector of collection
function physics.get_gravity() end

---Get a table for properties for a connected joint. The joint has to be created before
---properties can be retrieved.
---Note: Currently only supported in 2D physics.
---@param collisionobject string|hash|url collision object where the joint exist
---@param joint_id string|hash id of the joint
---@return table properties table. See the joint types for what fields are available, the only field available for all types is:
function physics.get_joint_properties(collisionobject, joint_id) end

---Get the reaction force for a joint. The joint has to be created before
---the reaction force can be calculated.
---Note: Currently only supported in 2D physics.
---@param collisionobject string|hash|url collision object where the joint exist
---@param joint_id string|hash id of the joint
---@return vector3 reaction force for the joint
function physics.get_joint_reaction_force(collisionobject, joint_id) end

---Get the reaction torque for a joint. The joint has to be created before
---the reaction torque can be calculated.
---Note: Currently only supported in 2D physics.
---@param collisionobject string|hash|url collision object where the joint exist
---@param joint_id string|hash id of the joint
---@return float the reaction torque on bodyB in N*m.
function physics.get_joint_reaction_torque(collisionobject, joint_id) end

---Ray casts are used to test for intersections against collision objects in the physics world.
---Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
---do not intersect with ray casts.
---Which collision objects to hit is filtered by their collision groups and can be configured
---through groups.
---@param from vector3 the world position of the start of the ray
---@param to vector3 the world position of the end of the ray
---@param groups table a lua table containing the hashed groups for which to test collisions against
---@param options table a lua table containing options for the raycast.
---@return table It returns a list. If missed it returns nil. See ray_cast_response for details on the returned values.
function physics.raycast(from, to, groups, options) end

---Ray casts are used to test for intersections against collision objects in the physics world.
---Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
---do not intersect with ray casts.
---Which collision objects to hit is filtered by their collision groups and can be configured
---through groups.
---The actual ray cast will be performed during the physics-update.
---
---
--- * If an object is hit, the result will be reported via a ray_cast_response message.
---
--- * If there is no object hit, the result will be reported via a ray_cast_missed message.
---@param from vector3 the world position of the start of the ray
---@param to vector3 the world position of the end of the ray
---@param groups table a lua table containing the hashed groups for which to test collisions against
---@param request_id number] a number between [0,-255 . It will be sent back in the response for identification, 0 by default
function physics.raycast_async(from, to, groups, request_id) end

---Set the gravity in runtime. The gravity change is not global, it will only affect
---the collection that the function is called from.
---Note: For 2D physics the z component of the gravity vector will be ignored.
---@param gravity vector3 the new gravity vector
function physics.set_gravity(gravity) end

---Flips the collision shapes horizontally for a collision object
---@param url string|hash|url the collision object that should flip its shapes
---@param flip boolean true if the collision object should flip its shapes, false if not
function physics.set_hflip(url, flip) end

---Updates the properties for an already connected joint. The joint has to be created before
---properties can be changed.
---Note: Currently only supported in 2D physics.
---@param collisionobject string|hash|url collision object where the joint exist
---@param joint_id string|hash id of the joint
---@param properties table joint specific properties table Note: The collide_connected field cannot be updated/changed after a connection has been made.
function physics.set_joint_properties(collisionobject, joint_id, properties) end

---Flips the collision shapes vertically for a collision object
---@param url string|hash|url the collision object that should flip its shapes
---@param flip boolean true if the collision object should flip its shapes, false if not
function physics.set_vflip(url, flip) end

---Collision objects tend to fall asleep when inactive for a small period of time for
---efficiency reasons. This function wakes them up.
---@param url string|hash|url the collision object to wake. function on_input(self, action_id, action)     if action_id == hash("test") and action.pressed then         physics.wakeup("#collisionobject")     end end
function physics.wakeup(url) end




return physics

<|start_filename|>.defold-api/base.lua<|end_filename|>
---@class vector3
---@field x number
---@field y number
---@field z number

---@class vector4
---@field x number
---@field y number
---@field z number
---@field w number

---@class quaternion
---@field x number
---@field y number
---@field z number
---@field w number

---@alias quat quaternion

---@class url
---@field socket
---@field path
---@field fragment

---@alias hash userdata
---@alias constant userdata
---@alias bool boolean
---@alias float number
---@alias object userdata
---@alias matrix4 userdata
---@alias node userdata

--mb use number instead of vector4
---@alias vector vector4

--luasocket
---@alias master userdata
---@alias unconnected userdata
---@alias client userdata

--render
---@alias constant_buffer userdata
---@alias render_target userdata
---@alias predicate userdata

--- Calls error if the value of its argument `v` is false (i.e., **nil** or
--- **false**); otherwise, returns all its arguments. In case of error,
--- `message` is the error object; when absent, it defaults to "assertion
--- failed!"
---@generic ANY
---@overload fun(v:any):any
---@param v ANY
---@param message string
---@return ANY
function assert(v,message) return v end

<|start_filename|>.defold-api/label.lua<|end_filename|>
---Label API documentation
---Label API documentation
---@class label
label = {}
---Gets the text from a label component
---@param url string|hash|url the label to get the text from
---@return string the label text
function label.get_text(url) end

---Gets the text metrics from a label component
---@param url string|hash|url the label to get the (unscaled) metrics from
---@return table a table with the following fields:
function label.get_text_metrics(url) end

---Sets the text of a label component
--- This method uses the message passing that means the value will be set after dispatch messages step.
---More information is available in the Application Lifecycle manual <>.
---@param url string|hash|url the label that should have a constant set
---@param text string the text
function label.set_text(url, text) end




return label

<|start_filename|>.defold-api/html5.lua<|end_filename|>
---HTML5 API documentation
---HTML5 platform specific functions.
--- The following functions are only available on HTML5 builds, the html5.* Lua namespace will not be available on other platforms.
---@class html5
html5 = {}
---Executes the supplied string as JavaScript inside the browser.
---A call to this function is blocking, the result is returned as-is, as a string.
---(Internally this will execute the string using the eval() JavaScript function.)
---@param code string Javascript code to run
---@return string result as string
function html5.run(code) end




return html5

<|start_filename|>.defold-api/model.lua<|end_filename|>
---Model API documentation
---Model API documentation
---@class model
model = {}
---Cancels all animation on a model component.
---@param url string|hash|url the model for which to cancel the animation
function model.cancel(url) end

---Gets the id of the game object that corresponds to a model skeleton bone.
---The returned game object can be used for parenting and transform queries.
---This function has complexity O(n), where n is the number of bones in the model skeleton.
---Game objects corresponding to a model skeleton bone can not be individually deleted.
---@param url string|hash|url the model to query
---@param bone_id string|hash id of the corresponding bone
---@return hash id of the game object
function model.get_go(url, bone_id) end

---Plays an animation on a model component with specified playback
---mode and parameters.
---An optional completion callback function can be provided that will be called when
---the animation has completed playing. If no function is provided,
---a model_animation_done <> message is sent to the script that started the animation.
--- The callback is not called (or message sent) if the animation is
---cancelled with model.cancel <>. The callback is called (or message sent) only for
---animations that play with the following playback modes:
---
---
--- * go.PLAYBACK_ONCE_FORWARD
---
--- * go.PLAYBACK_ONCE_BACKWARD
---
--- * go.PLAYBACK_ONCE_PINGPONG
---@param url string|hash|url the model for which to play the animation
---@param anim_id string|hash id of the animation to play
---@param playback constant playback mode of the animation
---@param play_properties table optional table with properties Play properties table:
---@param complete_function function(self, message_id, message, sender)) function to call when the animation has completed.
function model.play_anim(url, anim_id, playback, play_properties, complete_function) end




return model

<|start_filename|>.defold-api/zlib.lua<|end_filename|>
---Zlib compression API documentation
---Functions for compression and decompression of string buffers.
---@class zlib
zlib = {}
---A lua error is raised is on error
---@param buf string buffer to deflate
---@return string deflated buffer
function zlib.deflate(buf) end

---A lua error is raised is on error
---@param buf string buffer to inflate
---@return string inflated buffer
function zlib.inflate(buf) end




return zlib

<|start_filename|>.defold-api/math.lua<|end_filename|>
---Lua math standard library
---Documentation for the Lua math standard library.
---From Lua 5.1 Reference Manual <https://www.lua.org/manual/5.1/>
---by <NAME>, <NAME>, <NAME>.
---Copyright © 2006-2012 Lua.org, PUC-Rio.
---Freely available under the terms of the Lua license <https://www.lua.org/license.html>.
---@class math
math = {}
---Returns the absolute value of x.
---@param x  
function math.abs(x) end

---Returns the arc cosine of x (in radians).
---@param x  
function math.acos(x) end

---Returns the arc sine of x (in radians).
---@param x  
function math.asin(x) end

---Returns the arc tangent of x (in radians).
---@param x  
function math.atan(x) end

---Returns the arc tangent of y/x (in radians),
---but uses the signs of both parameters to find the
---quadrant of the result.
---(It also handles correctly the case of x being zero.)
---@param y  
---@param x  
function math.atan2(y, x) end

---Returns the smallest integer larger than or equal to x.
---@param x  
function math.ceil(x) end

---Returns the cosine of x (assumed to be in radians).
---@param x  
function math.cos(x) end

---Returns the hyperbolic cosine of x.
---@param x  
function math.cosh(x) end

---Returns the angle x (given in radians) in degrees.
---@param x  
function math.deg(x) end

---Returns the value ex.
---@param x  
function math.exp(x) end

---Returns the largest integer smaller than or equal to x.
---@param x  
function math.floor(x) end

---Returns the remainder of the division of x by y
---that rounds the quotient towards zero.
---@param x  
---@param y  
function math.fmod(x, y) end

---Returns m and e such that x = m2e,
---e is an integer and the absolute value of m is
---in the range [0.5, 1)
---(or zero when x is zero).
---@param x  
function math.frexp(x) end

---a huge value
math.huge = nil
---Returns m2e (e should be an integer).
---@param m  
---@param e  
function math.ldexp(m, e) end

---Returns the natural logarithm of x.
---@param x  
function math.log(x) end

---Returns the base-10 logarithm of x.
---@param x  
function math.log10(x) end

---Returns the maximum value among its arguments.
---@param x  
--- ...  
function math.max(x, ...) end

---Returns the minimum value among its arguments.
---@param x  
--- ...  
function math.min(x, ...) end

---Returns two numbers,
---the integral part of x and the fractional part of x.
---@param x  
function math.modf(x) end

---the value of pi
math.pi = nil
---Returns xy.
---(You can also use the expression x^y to compute this value.)
---@param x  
---@param y  
function math.pow(x, y) end

---Returns the angle x (given in degrees) in radians.
---@param x  
function math.rad(x) end

---This function is an interface to the simple
---pseudo-random generator function rand provided by ANSI C.
---(No guarantees can be given for its statistical properties.)
---When called without arguments,
---returns a uniform pseudo-random real number
---in the range [0,1).
---When called with an integer number m,
---math.random returns
---a uniform pseudo-random integer in the range [1, m].
---When called with two integer numbers m and n,
---math.random returns a uniform pseudo-random
---integer in the range [m, n].
---@param m  
---@param n  
function math.random(m, n) end

---Sets x as the "seed"
---for the pseudo-random generator:
---equal seeds produce equal sequences of numbers.
---@param x  
function math.randomseed(x) end

---Returns the sine of x (assumed to be in radians).
---@param x  
function math.sin(x) end

---Returns the hyperbolic sine of x.
---@param x  
function math.sinh(x) end

---Returns the square root of x.
---(You can also use the expression x^0.5 to compute this value.)
---@param x  
function math.sqrt(x) end

---Returns the tangent of x (assumed to be in radians).
---@param x  
function math.tan(x) end

---Returns the hyperbolic tangent of x.
---@param x  
function math.tanh(x) end




return math

<|start_filename|>.defold-api/luasocket.lua<|end_filename|>
---LuaSocket API documentation
---LuaSocket <https://github.com/diegonehab/luasocket> is a Lua extension library that provides
---support for the TCP and UDP transport layers. Defold provides the "socket" namespace in
---runtime, which contain the core C functionality. Additional LuaSocket support modules for
---SMTP, HTTP, FTP etc are not part of the core included, but can be easily added to a project
---and used.
---Note the included helper module "socket.lua" in "builtins/scripts/socket.lua". Require this
---module to add some additional functions and shortcuts to the namespace:
---require "builtins.scripts.socket"
---
---
---
---LuaSocket is Copyright © 2004-2007 <NAME>. All rights reserved.
---LuaSocket is free software, released under the MIT license (same license as the Lua core).
---@class socket
socket = {}
---Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
--- It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
function client:close() end

---Check the read buffer status.
--- This is an internal method, any use is unlikely to be portable.
---@return boolean true if there is any data in the read buffer, false otherwise.
function client:dirty() end

---Returns the underlying socket descriptor or handle associated to the object.
--- This is an internal method, any use is unlikely to be portable.
---@return number the descriptor or handle. In case the object has been closed, the return will be -1.
function client:getfd() end

---Gets options for the TCP object. See client:setoption <> for description of the option names and values.
---@param option string the name of the option to get:
---@return any the option value, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function client:getoption(option) end

---Returns information about the remote side of a connected client object.
--- It makes no sense to call this method on server objects.
---@return string a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function client:getpeername() end

---Returns the local address information associated to the object.
---@return string a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function client:getsockname() end

---Returns accounting information on the socket, useful for throttling of bandwidth.
---@return string a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
function client:getstats() end

---Reads data from a client object, according to the specified read pattern. Patterns follow the Lua file I/O format, and the difference in performance between patterns is negligible.
---@param pattern string|number the read pattern that can be any of the following:
---@param prefix string an optional string to be concatenated to the beginning of any received data before return.
---@return string the received pattern, or nil in case of error.
---@return string the error message, or nil if no error occurred. The error message can be the string "closed" in case the connection was closed before the transmission was completed or the string "timeout" in case there was a timeout during the operation.
---@return string a (possibly empty) string containing the partial that was received, or nil if no error occurred.
function client:receive(pattern, prefix) end

---Sends data through client object.
---The optional arguments i and j work exactly like the standard string.sub <> Lua function to allow the selection of a substring to be sent.
--- Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the .. operator) and send the result in one call instead of calling the method several times.
---@param data string the string to be sent.
---@param i number optional starting index of the string.
---@param j number optional end index of string.
---@return number] the index of the last byte within [i, j that has been sent, or nil in case of error. Notice that, if i is 1 or absent, this is effectively the total number of bytes sent.
---@return string the error message, or nil if no error occurred. The error message can be "closed" in case the connection was closed before the transmission was completed or the string "timeout" in case there was a timeout during the operation.
---@return number] in case of error, the index of the last byte within [i, j that has been sent. You might want to try again from the byte following that. nil if no error occurred.
function client:send(data, i, j) end

---Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
---@param handle number the descriptor or handle to set.
function client:setfd(handle) end

---Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
---@param option string the name of the option to set. The value is provided in the value parameter:
---@param value any the value to set for the specified option.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function client:setoption(option, value) end

---Resets accounting information on the socket, useful for throttling of bandwidth.
---@param received number the new number of bytes received.
---@param sent number the new number of bytes sent.
---@param age number the new age in seconds.
---@return number the value 1 in case of success, or nil in case of error.
function client:setstats(received, sent, age) end

---Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
---There are two timeout modes and both can be used together for fine tuning.
--- Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
---@param value number the amount of time to wait, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
---@param mode string optional timeout mode to set:
function client:settimeout(value, mode) end

---Shuts down part of a full-duplex connection.
---@param mode string which way of the connection should be shut down:
---@return number the value 1.
function client:shutdown(mode) end

---Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
--- It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
function connected:close() end

---Gets an option value from the UDP object. See connected:setoption <> for description of the option names and values.
---@param option string the name of the option to get:
---@return any the option value, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function connected:getoption(option) end

---Retrieves information about the peer associated with a connected UDP object.
--- It makes no sense to call this method on unconnected objects.
---@return string a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function connected:getpeername() end

---Returns the local address information associated to the object.
--- UDP sockets are not bound to any address until the setsockname or the sendto method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
---@return string a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function connected:getsockname() end

---Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
---@param size number optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
---@return string the received datagram, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function connected:receive(size) end

---Sends a datagram to the UDP peer of a connected object.
--- In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
---@param datagram string a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
---@return number the value 1 on success, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function connected:send(datagram) end

---Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
---@param option string the name of the option to set. The value is provided in the value parameter:
---@param value any the value to set for the specified option.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function connected:setoption(option, value) end

---Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
---For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the send and receive methods instead of sendto and receivefrom.
--- Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
---@param _ string if address is "*" and the object is connected, the peer association is removed and the object becomes an unconnected object again.
---@return number the value 1 on success, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function connected:setpeername(_) end

---Changes the timeout values for the object. By default, the receive and receivefrom  operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The settimeout function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
--- In UDP, the send and sendto methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the settimeout method has no effect on them.
---@param value number the amount of time to wait, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
function connected:settimeout(value) end

---Binds a master object to address and port on the local host.
---@param address string an IP address or a host name. If address is "*", the system binds to all local interfaces using the INADDR_ANY constant.
---@param port number the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function master:bind(address, port) end

---Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
--- It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
function master:close() end

---Attempts to connect a master object to a remote host, transforming it into a client object. Client objects support methods send, receive, getsockname, getpeername, settimeout, and close.
---Note that the function socket.connect is available and is a shortcut for the creation of client sockets.
---@param address string an IP address or a host name. If address is "*", the system binds to all local interfaces using the INADDR_ANY constant.
---@param port number the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function master:connect(address, port) end

---Check the read buffer status.
--- This is an internal method, any use is unlikely to be portable.
---@return boolean true if there is any data in the read buffer, false otherwise.
function master:dirty() end

---Returns the underlying socket descriptor or handle associated to the object.
--- This is an internal method, any use is unlikely to be portable.
---@return number the descriptor or handle. In case the object has been closed, the return will be -1.
function master:getfd() end

---Returns the local address information associated to the object.
---@return string a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function master:getsockname() end

---Returns accounting information on the socket, useful for throttling of bandwidth.
---@return string a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
function master:getstats() end

---Specifies the socket is willing to receive connections, transforming the object into a server object. Server objects support the accept, getsockname, setoption, settimeout, and close methods.
---@param backlog number the number of client connections that can be queued waiting for service. If the queue is full and another client attempts connection, the connection is refused.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function master:listen(backlog) end

---Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
---@param handle number the descriptor or handle to set.
function master:setfd(handle) end

---Resets accounting information on the socket, useful for throttling of bandwidth.
---@param received number the new number of bytes received.
---@param sent number the new number of bytes sent.
---@param age number the new age in seconds.
---@return number the value 1 in case of success, or nil in case of error.
function master:setstats(received, sent, age) end

---Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
---There are two timeout modes and both can be used together for fine tuning.
--- Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
---@param value number the amount of time to wait, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
---@param mode string optional timeout mode to set:
function master:settimeout(value, mode) end

---Waits for a remote connection on the server object and returns a client object representing that connection.
--- Calling socket.select with a server object in the recvt parameter before a call to accept does not guarantee accept will return immediately. Use the settimeout method or accept might block until another client shows up.
---@return client if a connection is successfully initiated, a client object is returned, or nil in case of error.
---@return string the error message, or nil if no error occurred. The error is "timeout" if a timeout condition is met.
function server:accept() end

---Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
--- It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
function server:close() end

---Check the read buffer status.
--- This is an internal method, any use is unlikely to be portable.
---@return boolean true if there is any data in the read buffer, false otherwise.
function server:dirty() end

---Returns the underlying socket descriptor or handle associated to the object.
--- This is an internal method, any use is unlikely to be portable.
---@return number the descriptor or handle. In case the object has been closed, the return will be -1.
function server:getfd() end

---Gets options for the TCP object. See server:setoption <> for description of the option names and values.
---@param option string the name of the option to get:
---@return any the option value, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function server:getoption(option) end

---Returns the local address information associated to the object.
---@return string a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function server:getsockname() end

---Returns accounting information on the socket, useful for throttling of bandwidth.
---@return string a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
function server:getstats() end

---Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
---@param handle number the descriptor or handle to set.
function server:setfd(handle) end

---Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
---@param option string the name of the option to set. The value is provided in the value parameter:
---@param value any the value to set for the specified option.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function server:setoption(option, value) end

---Resets accounting information on the socket, useful for throttling of bandwidth.
---@param received number the new number of bytes received.
---@param sent number the new number of bytes sent.
---@param age number the new age in seconds.
---@return number the value 1 in case of success, or nil in case of error.
function server:setstats(received, sent, age) end

---Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods send, receive, and accept will block indefinitely, until the operation completes. The settimeout method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
---There are two timeout modes and both can be used together for fine tuning.
--- Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
---@param value number the amount of time to wait, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
---@param mode string optional timeout mode to set:
function server:settimeout(value, mode) end

---max numbers of sockets the select function can handle
socket._SETSIZE = nil
---the current LuaSocket version
socket._VERSION = nil
---This function is a shortcut that creates and returns a TCP client object connected to a remote
---address at a given port. Optionally, the user can also specify the local address and port to
---bind (locaddr and locport), or restrict the socket family to "inet" or "inet6".
---Without specifying family to connect, whether a tcp or tcp6 connection is created depends on
---your system configuration.
---@param address string the address to connect to.
---@param port number the port to connect to.
---@param locaddr string optional local address to bind to.
---@param locport number optional local port to bind to.
---@param family string optional socket family to use, "inet" or "inet6".
---@return client a new IPv6 TCP client object, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function socket.connect(address, port, locaddr, locport, family) end

---This function converts a host name to IPv4 or IPv6 address.
---The supplied address can be an IPv4 or IPv6 address or host name.
---The function returns a table with all information returned by the resolver:
---{
--- [1] = {
---    family = family-name-1,
---    addr = address-1
---  },
---  ...
---  [n] = {
---    family = family-name-n,
---    addr = address-n
---  }
---}
---
---
---
---Here, family contains the string "inet" for IPv4 addresses, and "inet6" for IPv6 addresses.
---In case of error, the function returns nil followed by an error message.
---@param address string a hostname or an IPv4 or IPv6 address.
---@return table a table with all information returned by the resolver, or if an error occurs, nil.
---@return string the error message, or nil if no error occurred.
function socket.dns.getaddrinfo(address) end

---Returns the standard host name for the machine as a string.
---@return string the host name for the machine.
function socket.dns.gethostname() end

---This function converts an address to host name.
---The supplied address can be an IPv4 or IPv6 address or host name.
---The function returns a table with all information returned by the resolver:
---{
---  [1] = host-name-1,
---  ...
---  [n] = host-name-n,
---}
---@param address string a hostname or an IPv4 or IPv6 address.
---@return table a table with all information returned by the resolver, or if an error occurs, nil.
---@return string the error message, or nil if no error occurred.
function socket.dns.getnameinfo(address) end

---This function converts from an IPv4 address to host name.
---The address can be an IPv4 address or a host name.
---@param address string an IPv4 address or host name.
---@return string the canonic host name of the given address, or nil in case of an error.
---@return table|string a table with all information returned by the resolver, or if an error occurs, the error message string.
function socket.dns.tohostname(address) end

---This function converts a host name to IPv4 address.
---The address can be an IP address or a host name.
---@param address string a hostname or an IP address.
---@return string the first IP address found for the hostname, or nil in case of an error.
---@return table|string a table with all information returned by the resolver, or if an error occurs, the error message string.
function socket.dns.toip(address) end

---Returns the time in seconds, relative to the system epoch (Unix epoch time since January 1, 1970 (UTC) or Windows file time since January 1, 1601 (UTC)).
---You should use the values returned by this function for relative measurements only.
---@return number the number of seconds elapsed.
function socket.gettime() end

---This function creates and returns a clean try function that allows for cleanup before the exception is raised.
---The finalizer function will be called in protected mode (see protect <>).
---@param finalizer function() a function that will be called before the try throws the exception.
---@return function the customized try function.
function socket.newtry(finalizer) end

---Converts a function that throws exceptions into a safe function. This function only catches exceptions thrown by try functions. It does not catch normal Lua errors.
--- Beware that if your function performs some illegal operation that raises an error, the protected function will catch the error and return it as a string. This is because try functions uses errors as the mechanism to throw exceptions.
---@param func function a function that calls a try function (or assert, or error) to throw exceptions.
---@return function(function()) an equivalent function that instead of throwing exceptions, returns nil followed by an error message.
function socket.protect(func) end

---The function returns a list with the sockets ready for reading, a list with the sockets ready for writing and an error message. The error message is "timeout" if a timeout condition was met and nil otherwise. The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.
---Recvt and sendt parameters can be empty tables or nil. Non-socket values (or values with non-numeric indices) in these arrays will be silently ignored.
---The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.
--- This function can monitor a limited number of sockets, as defined by the constant socket._SETSIZE. This number may be as high as 1024 or as low as 64 by default, depending on the system. It is usually possible to change this at compile time. Invoking select with a larger number of sockets will raise an error.
--- A known bug in WinSock causes select to fail on non-blocking TCP sockets. The function may return a socket as writable even though the socket is not ready for sending.
--- Calling select with a server socket in the receive parameter before a call to accept does not guarantee accept will return immediately. Use the settimeout method or accept might block forever.
--- If you close a socket and pass it to select, it will be ignored.
---(Using select with non-socket objects: Any object that implements getfd and dirty can be used with select, allowing objects from other libraries to be used within a socket.select driven loop.)
---@param recvt table array with the sockets to test for characters available for reading.
---@param sendt table array with sockets that are watched to see if it is OK to immediately write on them.
---@param timeout number the maximum amount of time (in seconds) to wait for a change in status. Nil, negative or omitted timeout value allows the function to block indefinitely.
---@return table a list with the sockets ready for reading.
---@return table a list with the sockets ready for writing.
---@return string an error message. "timeout" if a timeout condition was met, otherwise nil.
function socket.select(recvt, sendt, timeout) end

---This function drops a number of arguments and returns the remaining.
---It is useful to avoid creation of dummy variables:
---D is the number of arguments to drop. Ret1 to retN are the arguments.
---The function returns retD+1 to retN.
---@param d number the number of arguments to drop.
---@param ret1 any argument 1.
---@param ret2 any argument 2.
---@param retN any argument N.
---@return any argument D+1.
---@return any argument D+2.
---@return any argument N.
function socket.skip(d, ret1, ret2, retN) end

---Freezes the program execution during a given amount of time.
---@param time number the number of seconds to sleep for.
function socket.sleep(time) end

---Creates and returns an IPv4 TCP master object. A master object can be transformed into a server object with the method listen (after a call to bind) or into a client object with the method connect. The only other method supported by a master object is the close method.
---@return master a new IPv4 TCP master object, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function socket.tcp() end

---Creates and returns an IPv6 TCP master object. A master object can be transformed into a server object with the method listen (after a call to bind) or into a client object with the method connect. The only other method supported by a master object is the close method.
---Note: The TCP object returned will have the option "ipv6-v6only" set to true.
---@return master a new IPv6 TCP master object, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function socket.tcp6() end

---Creates and returns an unconnected IPv4 UDP object. Unconnected objects support the sendto, receive, receivefrom, getoption, getsockname, setoption, settimeout, setpeername, setsockname, and close methods. The setpeername method is used to connect the object.
---@return unconnected a new unconnected IPv4 UDP object, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function socket.udp() end

---Creates and returns an unconnected IPv6 UDP object. Unconnected objects support the sendto, receive, receivefrom, getoption, getsockname, setoption, settimeout, setpeername, setsockname, and close methods. The setpeername method is used to connect the object.
---Note: The UDP object returned will have the option "ipv6-v6only" set to true.
---@return unconnected a new unconnected IPv6 UDP object, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function socket.udp6() end

---Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
--- It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
function unconnected:close() end

---Gets an option value from the UDP object. See unconnected:setoption <> for description of the option names and values.
---@param option string the name of the option to get:
---@return any the option value, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:getoption(option) end

---Returns the local address information associated to the object.
--- UDP sockets are not bound to any address until the setsockname or the sendto method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
---@return string a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns nil.
function unconnected:getsockname() end

---Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
---@param size number optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
---@return string the received datagram, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:receive(size) end

---Works exactly as the receive method, except it returns the IP address and port as extra return values (and is therefore slightly less efficient).
---@param size number optional maximum size of the datagram to be retrieved.
---@return string the received datagram, or nil in case of error.
---@return string the IP address, or the error message in case of error.
---@return number the port number, or nil in case of error.
function unconnected:receivefrom(size) end

---Sends a datagram to the specified IP address and port number.
--- In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
---@param datagram string a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
---@param ip string the IP address of the recipient. Host names are not allowed for performance reasons.
---@param port number the port number at the recipient.
---@return number the value 1 on success, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:sendto(datagram, ip, port) end

---Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
---@param option string the name of the option to set. The value is provided in the value parameter:
---@param value any the value to set for the specified option.
---@return number the value 1, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:setoption(option, value) end

---Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
---For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the send and receive methods instead of sendto and receivefrom.
--- Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
---@param address string an IP address or a host name.
---@param port number the port number.
---@return number the value 1 on success, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:setpeername(address, port) end

---Binds the UDP object to a local address.
--- This method can only be called before any datagram is sent through the UDP object, and only once. Otherwise, the system automatically binds the object to all local interfaces and chooses an ephemeral port as soon as the first datagram is sent. After the local address is set, either automatically by the system or explicitly by setsockname, it cannot be changed.
---@param address string an IP address or a host name. If address is "*" the system binds to all local interfaces using the constant INADDR_ANY.
---@param port number the port number. If port is 0, the system chooses an ephemeral port.
---@return number the value 1 on success, or nil in case of error.
---@return string the error message, or nil if no error occurred.
function unconnected:setsockname(address, port) end

---Changes the timeout values for the object. By default, the receive and receivefrom  operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The settimeout function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
--- In UDP, the send and sendto methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the settimeout method has no effect on them.
---@param value number the amount of time to wait, in seconds. The nil timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
function unconnected:settimeout(value) end




return socket

<|start_filename|>.defold-api/collection_proxy.lua<|end_filename|>
---Collection proxy API documentation
---Messages for controlling and interacting with collection proxies
---which are used to dynamically load collections into the runtime.
---@class collectionproxy
collectionproxy = {}
---return an indexed table of missing resources for a collection proxy. Each
---entry is a hexadecimal string that represents the data of the specific
---resource. This representation corresponds with the filename for each
---individual resource that is exported when you bundle an application with
---LiveUpdate functionality. It should be considered good practise to always
---check whether or not there are any missing resources in a collection proxy
---before attempting to load the collection proxy.
---@param collectionproxy url the collectionproxy to check for missing resources.
---@return table the missing resources
function collectionproxy.missing_resources(collectionproxy) end




return collectionproxy

<|start_filename|>.defold-api/bitop.lua<|end_filename|>
---Bitwise operations API documentation
---Lua BitOp <http://bitop.luajit.org/api.html> is a C extension module for Lua 5.1/5.2 which adds bitwise operations on numbers.
---Lua BitOp is Copyright © 2008-2012 <NAME>.
---Lua BitOp is free software, released under the MIT license (same license as the Lua core).
---Lua BitOp is compatible with the built-in bitwise operations in LuaJIT 2.0 and is used
---on platforms where Defold runs without LuaJIT.
---For clarity the examples assume the definition of a helper function printx().
---This prints its argument as an unsigned 32 bit hexadecimal number on all platforms:
---function printx(x)
---  print("0x"..bit.tohex(x))
---end

---@class bit
bit = {}
---Returns the bitwise arithmetic right-shift of its first argument by the number of bits given by the second argument.
---Arithmetic right-shift treats the most-significant bit as a sign bit and replicates it.
---Only the lower 5 bits of the shift count are used (reduces to the range [0..31]).
---@param x number number
---@param n number number of bits
---@return number bitwise arithmetic right-shifted number
function bit.arshift(x, n) end

---Returns the bitwise and of all of its arguments. Note that more than two arguments are allowed.
---@param x1 number number
--- ... number number(s)
---@return number bitwise and of the provided arguments
function bit.band(x1, ...) end

---Returns the bitwise not of its argument.
---@param x number number
---@return number bitwise not of number x
function bit.bnot(x) end

---Returns the bitwise or of all of its arguments. Note that more than two arguments are allowed.
---@param x1 number number
--- ... number number(s)
---@return number bitwise or of the provided arguments
function bit.bor(x1, ...) end

---Swaps the bytes of its argument and returns it. This can be used to convert little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.
---@param x number number
---@return number bitwise swapped number
function bit.bswap(x) end

---Returns the bitwise xor of all of its arguments. Note that more than two arguments are allowed.
---@param x1 number number
--- ... number number(s)
---@return number bitwise xor of the provided arguments
function bit.bxor(x1, ...) end

---Returns the bitwise logical left-shift of its first argument by the number of bits given by the second argument.
---Logical shifts treat the first argument as an unsigned number and shift in 0-bits.
---Only the lower 5 bits of the shift count are used (reduces to the range [0..31]).
---@param x number number
---@param n number number of bits
---@return number bitwise logical left-shifted number
function bit.lshift(x, n) end

---Returns the bitwise left rotation of its first argument by the number of bits given by the second argument. Bits shifted out on one side are shifted back in on the other side.
---Only the lower 5 bits of the rotate count are used (reduces to the range [0..31]).
---@param x number number
---@param n number number of bits
---@return number bitwise left-rotated number
function bit.rol(x, n) end

---Returns the bitwise right rotation of its first argument by the number of bits given by the second argument. Bits shifted out on one side are shifted back in on the other side.
---Only the lower 5 bits of the rotate count are used (reduces to the range [0..31]).
---@param x number number
---@param n number number of bits
---@return number bitwise right-rotated number
function bit.ror(x, n) end

---Returns the bitwise logical right-shift of its first argument by the number of bits given by the second argument.
---Logical shifts treat the first argument as an unsigned number and shift in 0-bits.
---Only the lower 5 bits of the shift count are used (reduces to the range [0..31]).
---@param x number number
---@param n number number of bits
---@return number bitwise logical right-shifted number
function bit.rshift(x, n) end

---Normalizes a number to the numeric range for bit operations and returns it. This function is usually not needed since all bit operations already normalize all of their input arguments.
---@param x number number to normalize
---@return number normalized number
function bit.tobit(x) end

---Converts its first argument to a hex string. The number of hex digits is given by the absolute value of the optional second argument. Positive numbers between 1 and 8 generate lowercase hex digits. Negative numbers generate uppercase hex digits. Only the least-significant 4*|n| bits are used. The default is to generate 8 lowercase hex digits.
---@param x number number to convert
---@param n number number of hex digits to return
---@return string hexadecimal string
function bit.tohex(x, n) end




return bit

<|start_filename|>.defold-api/os.lua<|end_filename|>
---Lua os standard library
---Documentation for the Lua os standard library.
---From Lua 5.1 Reference Manual <https://www.lua.org/manual/5.1/>
---by <NAME>, <NAME>, <NAME>.
---Copyright © 2006-2012 Lua.org, PUC-Rio.
---Freely available under the terms of the Lua license <https://www.lua.org/license.html>.
---@class os
os = {}
---Returns an approximation of the amount in seconds of CPU time
---used by the program.
function os.clock() end

---Returns a string or a table containing date and time,
---formatted according to the given string format.
---If the time argument is present,
---this is the time to be formatted
---(see the os.time function for a description of this value).
---Otherwise, date formats the current time.
---If format starts with '!',
---then the date is formatted in Coordinated Universal Time.
---After this optional character,
---if format is the string "*t",
---then date returns a table with the following fields:
---year (four digits), month (1--12), day (1--31),
---hour (0--23), min (0--59), sec (0--61),
---wday (weekday, Sunday is 1),
---yday (day of the year),
---and isdst (daylight saving flag, a boolean).
---If format is not "*t",
---then date returns the date as a string,
---formatted according to the same rules as the C function strftime.
---When called without arguments,
---date returns a reasonable date and time representation that depends on
---the host system and on the current locale
---(that is, os.date() is equivalent to os.date("%c")).
---@param format  
---@param time  
function os.date(format, time) end

---Returns the number of seconds from time t1 to time t2.
---In POSIX, Windows, and some other systems,
---this value is exactly t2-t1.
---@param t2  
---@param t1  
function os.difftime(t2, t1) end

---This function is equivalent to the C function system.
---It passes command to be executed by an operating system shell.
---It returns a status code, which is system-dependent.
---If command is absent, then it returns nonzero if a shell is available
---and zero otherwise.
---@param command  
function os.execute(command) end

---Calls the C function exit,
---with an optional code,
---to terminate the host program.
---The default value for code is the success code.
---Calling os.exit will do a hard exit which will not run
---the engine shutdown code. This may cause crashes on exit.
---The recommended way to terminate your game is by using
---the exit message which does a graceful shutdown.
---msg.post("@system:", "exit", {code = 0})
---@param code  
function os.exit(code) end

---Returns the value of the process environment variable varname,
---or  nil if the variable is not defined.
---@param varname  
function os.getenv(varname) end

---Deletes the file or directory with the given name.
---Directories must be empty to be removed.
---If this function fails, it returns  nil,
---plus a string describing the error.
---@param filename  
function os.remove(filename) end

---Renames file or directory named oldname to newname.
---If this function fails, it returns  nil,
---plus a string describing the error.
---@param oldname  
---@param newname  
function os.rename(oldname, newname) end

---Sets the current locale of the program.
---locale is a string specifying a locale;
---category is an optional string describing which category to change:
---"all", "collate", "ctype",
---"monetary", "numeric", or "time";
---the default category is "all".
---The function returns the name of the new locale,
---or  nil if the request cannot be honored.
---If locale is the empty string,
---the current locale is set to an implementation-defined native locale.
---If locale is the string "C",
---the current locale is set to the standard C locale.
---When called with  nil as the first argument,
---this function only returns the name of the current locale
---for the given category.
---@param locale  
---@param category  
function os.setlocale(locale, category) end

---Returns the current time when called without arguments,
---or a time representing the date and time specified by the given table.
---This table must have fields year, month, and day,
---and may have fields hour, min, sec, and isdst
---(for a description of these fields, see the os.date function).
---The returned value is a number, whose meaning depends on your system.
---In POSIX, Windows, and some other systems, this number counts the number
---of seconds since some given start time (the "epoch").
---In other systems, the meaning is not specified,
---and the number returned by time can be used only as an argument to
---date and difftime.
---@param table  
function os.time(table) end

---Returns a string with a file name that can
---be used for a temporary file.
---The file must be explicitly opened before its use
---and explicitly removed when no longer needed.
---On some systems (POSIX),
---this function also creates a file with that name,
---to avoid security risks.
---(Someone else might create the file with wrong permissions
---in the time between getting the name and creating the file.)
---You still have to open the file to use it
---and to remove it (even if you do not use it).
---When possible,
---you may prefer to use io.tmpfile,
---which automatically removes the file when the program ends.
function os.tmpname() end




return os

<|start_filename|>.defold-api/built-ins.lua<|end_filename|>
---Built-ins API documentation
---Built-in scripting functions.

---All ids in the engine are represented as hashes, so a string needs to be hashed
---before it can be compared with an id.
---@param s string string to hash
---@return hash a hashed string
function hash(s) end

---Returns a hexadecimal representation of a hash value.
---The returned string is always padded with leading zeros.
---@param h hash hash value to get hex string for
---@return string hex representation of the hash
function hash_to_hex(h) end

---Pretty printing of Lua values. This function prints Lua values
---in a manner similar to +print()+, but will also recurse into tables
---and pretty print them. There is a limit to how deep the function
---will recurse.
---@param v any value to print
function pprint(v) end





<|start_filename|>.defold-api/spine.lua<|end_filename|>
---Spine model API documentation
---Spine model API documentation
---@class spine
spine = {}
---Cancels all running animations on a specified spine model component.
---@param url string|hash|url the spine model for which to cancel the animation
function spine.cancel(url) end

---Returns the id of the game object that corresponds to a specified skeleton bone.
---The returned game object can be used for parenting and transform queries.
---This function has complexity O(n), where n is the number of bones in the spine model skeleton.
---Game objects corresponding to a spine model skeleton bone can not be individually deleted.
---@param url string|hash|url the spine model to query
---@param bone_id string|hash id of the corresponding bone
---@return hash id of the game object
function spine.get_go(url, bone_id) end

---Plays a specified animation on a spine model component with specified playback
---mode and parameters.
---An optional completion callback function can be provided that will be called when
---the animation has completed playing. If no function is provided,
---a spine_animation_done <> message is sent to the script that started the animation.
--- The callback is not called (or message sent) if the animation is
---cancelled with spine.cancel <>. The callback is called (or message sent) only for
---animations that play with the following playback modes:
---
---
--- * go.PLAYBACK_ONCE_FORWARD
---
--- * go.PLAYBACK_ONCE_BACKWARD
---
--- * go.PLAYBACK_ONCE_PINGPONG
---@param url string|hash|url the spine model for which to play the animation
---@param anim_id string|hash id of the animation to play
---@param playback constant playback mode of the animation
---@param play_properties table optional table with properties:
---@param complete_function function(self, message_id, message, sender)) function to call when the animation has completed.
function spine.play_anim(url, anim_id, playback, play_properties, complete_function) end

---Resets any previously set IK target of a spine model, the position will be reset
---to the original position from the spine scene.
---@param url string|hash|url the spine model containing the object
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
function spine.reset_ik_target(url, ik_constraint_id) end

---Sets a game object as target position of an inverse kinematic (IK) object. As the
---target game object's position is updated, the constraint object is updated with the
---new position.
---@param url string|hash|url the spine model containing the object
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
---@param target_url string|hash|url target game object
function spine.set_ik_target(url, ik_constraint_id, target_url) end

---Sets a static (vector3) target position of an inverse kinematic (IK) object.
---@param url string|hash|url the spine model containing the object
---@param ik_constraint_id string|hash id of the corresponding IK constraint object
---@param position vector3 target position
function spine.set_ik_target_position(url, ik_constraint_id, position) end

---Sets the spine skin on a spine model.
---@param url string|hash|url the spine model for which to set skin
---@param spine_skin string|hash spine skin id
---@param spine_slot string|hash optional slot id to only change a specific slot
function spine.set_skin(url, spine_skin, spine_slot) end




return spine

<|start_filename|>.defold-api/particle_effects.lua<|end_filename|>
---Particle effects API documentation
---Functions for controlling particle effect component playback and
---shader constants.
---@class particlefx
particlefx = {}
---postspawn state
particlefx.EMITTER_STATE_POSTSPAWN = nil
---prespawn state
particlefx.EMITTER_STATE_PRESPAWN = nil
---sleeping state
particlefx.EMITTER_STATE_SLEEPING = nil
---spawning state
particlefx.EMITTER_STATE_SPAWNING = nil
---Starts playing a particle FX component.
---Particle FX started this way need to be manually stopped through particlefx.stop().
---Which particle FX to play is identified by the URL.
--- A particle FX will continue to emit particles even if the game object the particle FX component belonged to is deleted. You can call particlefx.stop() to stop it from emitting more particles.
---@param url string|hash|url the particle fx that should start playing.
---@param emitter_state_function function(self, id, emitter, state) optional callback function that will be called when an emitter attached to this particlefx changes state.
function particlefx.play(url, emitter_state_function) end

---Resets a shader constant for a particle FX component emitter.
---The constant must be defined in the material assigned to the emitter.
---Resetting a constant through this function implies that the value defined in the material will be used.
---Which particle FX to reset a constant for is identified by the URL.
---@param url string|hash|url the particle FX that should have a constant reset
---@param emitter string|hash the id of the emitter
---@param constant string|hash the name of the constant
function particlefx.reset_constant(url, emitter, constant) end

---Sets a shader constant for a particle FX component emitter.
---The constant must be defined in the material assigned to the emitter.
---Setting a constant through this function will override the value set for that constant in the material.
---The value will be overridden until particlefx.reset_constant is called.
---Which particle FX to set a constant for is identified by the URL.
---@param url string|hash|url the particle FX that should have a constant set
---@param emitter string|hash the id of the emitter
---@param constant string|hash the name of the constant
---@param value vector4 the value of the constant
function particlefx.set_constant(url, emitter, constant, value) end

---Stops a particle FX component from playing.
---Stopping a particle FX does not remove already spawned particles.
---Which particle FX to stop is identified by the URL.
---@param url string|hash|url the particle fx that should stop playing
function particlefx.stop(url) end




return particlefx

<|start_filename|>.defold-api/vector_math.lua<|end_filename|>
---Vector math API documentation
---Functions for mathematical operations on vectors, matrices and quaternions.
---
---
--- * The vector types (vmath.vector3 and vmath.vector4) supports addition and subtraction
---  with vectors of the same type. Vectors can be negated and multiplied (scaled) or divided by numbers.
---
--- * The quaternion type (vmath.quat) supports multiplication with other quaternions.
---
--- * The matrix type (vmath.matrix4) can be multiplied with numbers, other matrices
---  and vmath.vector4 values.
---
--- * All types performs equality comparison by each component value.
---
---The following components are available for the various types:
---
---  vector3
---x, y and z. Example: v.y
---  vector4
---x, y, z, and w. Example: v.w
---  quaternion
---x, y, z, and w. Example: q.w
---  matrix4
---m00 to m33 where the first number is the row (starting from 0) and the second
---number is the column. Columns can be accessed with c0 to c3, returning a vector4.
---Example: m.m21 which is equal to m.c1.z
---  vector
---indexed by number 1 to the vector length. Example: v[3]

---@class vmath
vmath = {}
---Calculates the conjugate of a quaternion. The result is a
---quaternion with the same magnitudes but with the sign of
---the imaginary (vector) parts changed:
---q* = [w, -v]
---@param q1 quaternion quaternion of which to calculate the conjugate
---@return quaternion the conjugate
function vmath.conj(q1) end

---Given two linearly independent vectors P and Q, the cross product,
---P × Q, is a vector that is perpendicular to both P and Q and
---therefore normal to the plane containing them.
---If the two vectors have the same direction (or have the exact
---opposite direction from one another, i.e. are not linearly independent)
---or if either one has zero length, then their cross product is zero.
---@param v1 vector3 first vector
---@param v2 vector3 second vector
---@return vector3 a new vector representing the cross product
function vmath.cross(v1, v2) end

---The returned value is a scalar defined as:
---P ⋅ Q = |P| |Q| cos θ
---where θ is the angle between the vectors P and Q.
---
---
--- * If the dot product is positive then the angle between the vectors is below 90 degrees.
---
--- * If the dot product is zero the vectors are perpendicular (at right-angles to each other).
---
--- * If the dot product is negative then the angle between the vectors is more than 90 degrees.
---@param v1 vector3|vector4 first vector
---@param v2 vector3|vector4 second vector
---@return number dot product
function vmath.dot(v1, v2) end

---The resulting matrix is the inverse of the supplied matrix.
--- For ortho-normal matrices, e.g. regular object transformation,
---use vmath.ortho_inv() instead.
---The specialized inverse for ortho-normalized matrices is much faster
---than the general inverse.
---@param m1 matrix4 matrix to invert
---@return matrix4 inverse of the supplied matrix
function vmath.inv(m1) end

---Returns the length of the supplied vector or quaternion.
---If you are comparing the lengths of vectors or quaternions, you should compare
---the length squared instead as it is slightly more efficient to calculate
---(it eliminates a square root calculation).
---@param v vector3|vector4|quat value of which to calculate the length
---@return number length
function vmath.length(v) end

---Returns the squared length of the supplied vector or quaternion.
---@param v vector3|vector4|quat value of which to calculate the squared length
---@return number squared length
function vmath.length_sqr(v) end

---Linearly interpolate between two vectors. The function
---treats the vectors as positions and interpolates between
---the positions in a straight line. Lerp is useful to describe
---transitions from one place to another over time.
--- The function does not clamp t between 0 and 1.
---@param t number interpolation parameter, 0-1
---@param v1 vector3|vector4 vector to lerp from
---@param v2 vector3|vector4 vector to lerp to
---@return vector3|vector4 the lerped vector
function vmath.lerp(t, v1, v2) end

---Linearly interpolate between two quaternions. Linear
---interpolation of rotations are only useful for small
---rotations. For interpolations of arbitrary rotations,
---vmath.slerp <> yields much better results.
--- The function does not clamp t between 0 and 1.
---@param t number interpolation parameter, 0-1
---@param q1 quaternion quaternion to lerp from
---@param q2 quaternion quaternion to lerp to
---@return quaternion the lerped quaternion
function vmath.lerp(t, q1, q2) end

---Linearly interpolate between two values. Lerp is useful
---to describe transitions from one value to another over time.
--- The function does not clamp t between 0 and 1.
---@param t number interpolation parameter, 0-1
---@param n1 number number to lerp from
---@param n2 number number to lerp to
---@return number the lerped number
function vmath.lerp(t, n1, n2) end

---The resulting identity matrix describes a transform with
---no translation or rotation.
---@return matrix4 identity matrix
function vmath.matrix4() end

---Creates a new matrix with all components set to the
---corresponding values from the supplied matrix. I.e.
---the function creates a copy of the given matrix.
---@param m1 matrix4 existing matrix
---@return matrix4 matrix which is a copy of the specified matrix
function vmath.matrix4(m1) end

---The resulting matrix describes a rotation around the axis by the specified angle.
---@param v vector3 axis
---@param angle number angle in radians
---@return matrix4 matrix represented by axis and angle
function vmath.matrix4_axis_angle(v, angle) end

---The resulting matrix describes the same rotation as the quaternion, but does not have any translation (also like the quaternion).
---@param q quaternion quaternion to create matrix from
---@return matrix4 matrix represented by quaternion
function vmath.matrix4_from_quat(q) end

---Constructs a frustum matrix from the given values. The left, right,
---top and bottom coordinates of the view cone are expressed as distances
---from the center of the near clipping plane. The near and far coordinates
---are expressed as distances from the tip of the view frustum cone.
---@param left number coordinate for left clipping plane
---@param right number coordinate for right clipping plane
---@param bottom number coordinate for bottom clipping plane
---@param top number coordinate for top clipping plane
---@param near number coordinate for near clipping plane
---@param far number coordinate for far clipping plane
---@return matrix4 matrix representing the frustum
function vmath.matrix4_frustum(left, right, bottom, top, near, far) end

---The resulting matrix is created from the supplied look-at parameters.
---This is useful for constructing a view matrix for a camera or
---rendering in general.
---@param eye vector3 eye position
---@param look_at vector3 look-at position
---@param up vector3 up vector
---@return matrix4 look-at matrix
function vmath.matrix4_look_at(eye, look_at, up) end

---Creates an orthographic projection matrix.
---This is useful to construct a projection matrix for a camera or rendering in general.
---@param left number coordinate for left clipping plane
---@param right number coordinate for right clipping plane
---@param bottom number coordinate for bottom clipping plane
---@param top number coordinate for top clipping plane
---@param near number coordinate for near clipping plane
---@param far number coordinate for far clipping plane
---@return matrix4 orthographic projection matrix
function vmath.matrix4_orthographic(left, right, bottom, top, near, far) end

---Creates a perspective projection matrix.
---This is useful to construct a projection matrix for a camera or rendering in general.
---@param fov number angle of the full vertical field of view in radians
---@param aspect number aspect ratio
---@param near number coordinate for near clipping plane
---@param far number coordinate for far clipping plane
---@return matrix4 perspective projection matrix
function vmath.matrix4_perspective(fov, aspect, near, far) end

---The resulting matrix describes a rotation around the x-axis
---by the specified angle.
---@param angle number angle in radians around x-axis
---@return matrix4 matrix from rotation around x-axis
function vmath.matrix4_rotation_x(angle) end

---The resulting matrix describes a rotation around the y-axis
---by the specified angle.
---@param angle number angle in radians around y-axis
---@return matrix4 matrix from rotation around y-axis
function vmath.matrix4_rotation_y(angle) end

---The resulting matrix describes a rotation around the z-axis
---by the specified angle.
---@param angle number angle in radians around z-axis
---@return matrix4 matrix from rotation around z-axis
function vmath.matrix4_rotation_z(angle) end

---The resulting matrix describes a translation of a point
---in euclidean space.
---@param position vector3|vector4 position vector to create matrix from
---@return matrix4 matrix from the supplied position vector
function vmath.matrix4_translation(position) end

---Performs an element wise multiplication between two vectors of the same type
---The returned value is a vector defined as (e.g. for a vector3):
---v = vmath.mul_per_elem(a, b) = vmath.vector3(a.x * b.x, a.y * b.y, a.z * b.z)
---@param v1 vector3|vector4 first vector
---@param v2 vector3|vector4 second vector
---@return vector3|vector4 multiplied vector
function vmath.mul_per_elem(v1, v2) end

---Normalizes a vector, i.e. returns a new vector with the same
---direction as the input vector, but with length 1.
--- The length of the vector must be above 0, otherwise a
---division-by-zero will occur.
---@param v1 vector3|vector4|quat vector to normalize
---@return vector3|vector4|quat new normalized vector
function vmath.normalize(v1) end

---The resulting matrix is the inverse of the supplied matrix.
---The supplied matrix has to be an ortho-normal matrix, e.g.
---describe a regular object transformation.
--- For matrices that are not ortho-normal
---use the general inverse vmath.inv() instead.
---@param m1 matrix4 ortho-normalized matrix to invert
---@return matrix4 inverse of the supplied matrix
function vmath.ortho_inv(m1) end

---Calculates the extent the projection of the first vector onto the second.
---The returned value is a scalar p defined as:
---p = |P| cos θ / |Q|
---where θ is the angle between the vectors P and Q.
---@param v1 vector3 vector to be projected on the second
---@param v2 vector3 vector onto which the first will be projected, must not have zero length
---@return number the projected extent of the first vector onto the second
function vmath.project(v1, v2) end

---Creates a new identity quaternion. The identity
---quaternion is equal to:
---vmath.quat(0, 0, 0, 1)
---@return quaternion new identity quaternion
function vmath.quat() end

---Creates a new quaternion with all components set to the
---corresponding values from the supplied quaternion. I.e.
---This function creates a copy of the given quaternion.
---@param q1 quaternion existing quaternion
---@return quaternion new quaternion
function vmath.quat(q1) end

---Creates a new quaternion with the components set
---according to the supplied parameter values.
---@param x number x coordinate
---@param y number y coordinate
---@param z number z coordinate
---@param w number w coordinate
---@return quaternion new quaternion
function vmath.quat(x, y, z, w) end

---The resulting quaternion describes a rotation of angle
---radians around the axis described by the unit vector v.
---@param v vector3 axis
---@param angle number angle
---@return quaternion quaternion representing the axis-angle rotation
function vmath.quat_axis_angle(v, angle) end

---The resulting quaternion describes the rotation from the
---identity quaternion (no rotation) to the coordinate system
---as described by the given x, y and z base unit vectors.
---@param x vector3 x base vector
---@param y vector3 y base vector
---@param z vector3 z base vector
---@return quaternion quaternion representing the rotation of the specified base vectors
function vmath.quat_basis(x, y, z) end

---The resulting quaternion describes the rotation that,
---if applied to the first vector, would rotate the first
---vector to the second. The two vectors must be unit
---vectors (of length 1).
--- The result is undefined if the two vectors point in opposite directions
---@param v1 vector3 first unit vector, before rotation
---@param v2 vector3 second unit vector, after rotation
---@return quaternion quaternion representing the rotation from first to second vector
function vmath.quat_from_to(v1, v2) end

---The resulting quaternion describes a rotation of angle
---radians around the x-axis.
---@param angle number angle in radians around x-axis
---@return quaternion quaternion representing the rotation around the x-axis
function vmath.quat_rotation_x(angle) end

---The resulting quaternion describes a rotation of angle
---radians around the y-axis.
---@param angle number angle in radians around y-axis
---@return quaternion quaternion representing the rotation around the y-axis
function vmath.quat_rotation_y(angle) end

---The resulting quaternion describes a rotation of angle
---radians around the z-axis.
---@param angle number angle in radians around z-axis
---@return quaternion quaternion representing the rotation around the z-axis
function vmath.quat_rotation_z(angle) end

---Returns a new vector from the supplied vector that is
---rotated by the rotation described by the supplied
---quaternion.
---@param q quaternion quaternion
---@param v1 vector3 vector to rotate
---@return vector3 the rotated vector
function vmath.rotate(q, v1) end

---Spherically interpolates between two vectors. The difference to
---lerp is that slerp treats the vectors as directions instead of
---positions in space.
---The direction of the returned vector is interpolated by the angle
---and the magnitude is interpolated between the magnitudes of the
---from and to vectors.
--- Slerp is computationally more expensive than lerp.
---The function does not clamp t between 0 and 1.
---@param t number interpolation parameter, 0-1
---@param v1 vector3|vector4 vector to slerp from
---@param v2 vector3|vector4 vector to slerp to
---@return vector3|vector4 the slerped vector
function vmath.slerp(t, v1, v2) end

---Slerp travels the torque-minimal path maintaining constant
---velocity, which means it travels along the straightest path along
---the rounded surface of a sphere. Slerp is useful for interpolation
---of rotations.
---Slerp travels the torque-minimal path, which means it travels
---along the straightest path the rounded surface of a sphere.
--- The function does not clamp t between 0 and 1.
---@param t number interpolation parameter, 0-1
---@param q1 quaternion quaternion to slerp from
---@param q2 quaternion quaternion to slerp to
---@return quaternion the slerped quaternion
function vmath.slerp(t, q1, q2) end

---Creates a vector of arbitrary size. The vector is initialized
---with numeric values from a table.
--- The table values are converted to floating point
---values. If a value cannot be converted, a 0 is stored in that
---value position in the vector.
---@param t table table of numbers
---@return vector new vector
function vmath.vector(t) end

---Creates a new zero vector with all components set to 0.
---@return vector3 new zero vector
function vmath.vector3() end

---Creates a new vector with all components set to the
---supplied scalar value.
---@param n number scalar value to splat
---@return vector3 new vector
function vmath.vector3(n) end

---Creates a new vector with all components set to the
---corresponding values from the supplied vector. I.e.
---This function creates a copy of the given vector.
---@param v1 vector3 existing vector
---@return vector3 new vector
function vmath.vector3(v1) end

---Creates a new vector with the components set to the
---supplied values.
---@param x number x coordinate
---@param y number y coordinate
---@param z number z coordinate
---@return vector3 new vector
function vmath.vector3(x, y, z) end

---Creates a new zero vector with all components set to 0.
---@return vector4 new zero vector
function vmath.vector4() end

---Creates a new vector with all components set to the
---supplied scalar value.
---@param n number scalar value to splat
---@return vector4 new vector
function vmath.vector4(n) end

---Creates a new vector with all components set to the
---corresponding values from the supplied vector. I.e.
---This function creates a copy of the given vector.
---@param v1 vector4 existing vector
---@return vector4 new vector
function vmath.vector4(v1) end

---Creates a new vector with the components set to the
---supplied values.
---@param x number x coordinate
---@param y number y coordinate
---@param z number z coordinate
---@param w number w coordinate
---@return vector4 new vector
function vmath.vector4(x, y, z, w) end




return vmath

<|start_filename|>.defold-api/json.lua<|end_filename|>
---JSON API documentation
---Manipulation of JSON data strings.
---@class json
json = {}
---Decode a string of JSON data into a Lua table.
---A Lua error is raised for syntax errors.
---@param json string json data
---@return table decoded json
function json.decode(json) end




return json

<|start_filename|>.defold-api/factory.lua<|end_filename|>
---Factory API documentation
---Functions for controlling factory components which are used to
---dynamically spawn game objects into the runtime.
---@class factory
factory = {}
---loaded
factory.STATUS_LOADED = nil
---loading
factory.STATUS_LOADING = nil
---unloaded
factory.STATUS_UNLOADED = nil
---The URL identifies which factory should create the game object.
---If the game object is created inside of the frame (e.g. from an update callback), the game object will be created instantly, but none of its component will be updated in the same frame.
---Properties defined in scripts in the created game object can be overridden through the properties-parameter below.
---See go.property for more information on script properties.
--- Calling factory.create <> on a factory that is marked as dynamic without having loaded resources
---using factory.load <> will synchronously load and create resources which may affect application performance.
---@param url string|hash|url the factory that should create a game object.
---@param position vector3 the position of the new game object, the position of the game object calling factory.create() is used by default, or if the value is nil.
---@param rotation quaternion the rotation of the new game object, the rotation of the game object calling factory.create() is used by default, or if the value is nil.
---@param properties table the properties defined in a script attached to the new game object.
---@param scale number|vector3 the scale of the new game object (must be greater than 0), the scale of the game object containing the factory is used by default, or if the value is nil
---@return hash the global id of the spawned game object
function factory.create(url, position, rotation, properties, scale) end

---This returns status of the factory.
---Calling this function when the factory is not marked as dynamic loading always returns
---factory.STATUS_LOADED.
---@param url string|hash|url the factory component to get status from
---@return constant status of the factory component
function factory.get_status(url) end

---Resources are referenced by the factory component until the existing (parent) collection is destroyed or factory.unload is called.
---Calling this function when the factory is not marked as dynamic loading does nothing.
---@param url string|hash|url the factory component to load
---@param complete_function function(self, url, result)) function to call when resources are loaded.
function factory.load(url, complete_function) end

---This decreases the reference count for each resource loaded with factory.load. If reference is zero, the resource is destroyed.
---Calling this function when the factory is not marked as dynamic loading does nothing.
---@param url string|hash|url the factory component to unload
function factory.unload(url) end




return factory

<|start_filename|>.defold-api/io.lua<|end_filename|>
---Lua io standard library
---Documentation for the Lua io standard library.
---From Lua 5.1 Reference Manual <https://www.lua.org/manual/5.1/>
---by <NAME>, <NAME>, <NAME>.
---Copyright © 2006-2012 Lua.org, PUC-Rio.
---Freely available under the terms of the Lua license <https://www.lua.org/license.html>.
---@class io
io = {}
---Closes file.
---Note that files are automatically closed when
---their handles are garbage collected,
---but that takes an unpredictable amount of time to happen.
function file:close() end

---Saves any written data to file.
function file:flush() end

---Returns an iterator function that,
---each time it is called,
---returns a new line from the file.
---Therefore, the construction
---for line in file:lines() do body end
---
---
---
---will iterate over all lines of the file.
---(Unlike io.lines, this function does not close the file
---when the loop ends.)
function file:lines() end

---Reads the file file,
---according to the given formats, which specify what to read.
---For each format,
---the function returns a string (or a number) with the characters read,
---or  nil if it cannot read data with the specified format.
---When called without formats,
---it uses a default format that reads the entire next line
---(see below).
---The available formats are
---
---  "*n"
---reads a number;
---this is the only format that returns a number instead of a string.
---  "*a"
---reads the whole file, starting at the current position.
---On end of file, it returns the empty string.
---  "*l"
---reads the next line (skipping the end of line),
---returning  nil on end of file.
---This is the default format.
---  number
---reads a string with up to this number of characters,
---returning  nil on end of file.
---If number is zero,
---it reads nothing and returns an empty string,
---or  nil on end of file.
--- ...  
function file:read(...) end

---Sets and gets the file position,
---measured from the beginning of the file,
---to the position given by offset plus a base
---specified by the string whence, as follows:
---
---  "set"
---base is position 0 (beginning of the file);
---  "cur"
---base is current position;
---  "end"
---base is end of file;
---
---In case of success, function seek returns the final file position,
---measured in bytes from the beginning of the file.
---If this function fails, it returns  nil,
---plus a string describing the error.
---The default value for whence is "cur",
---and for offset is 0.
---Therefore, the call file:seek() returns the current
---file position, without changing it;
---the call file:seek("set") sets the position to the
---beginning of the file (and returns 0);
---and the call file:seek("end") sets the position to the
---end of the file, and returns its size.
---@param whence  
---@param offset  
function file:seek(whence, offset) end

---Sets the buffering mode for an output file.
---There are three available modes:
---
---  "no"
---no buffering; the result of any output operation appears immediately.
---  "full"
---full buffering; output operation is performed only
---when the buffer is full (or when you explicitly flush the file
---).
---  "line"
---line buffering; output is buffered until a newline is output
---or there is any input from some special files
---(such as a terminal device).
---
---For the last two cases, size
---specifies the size of the buffer, in bytes.
---The default is an appropriate size.
---@param mode  
---@param size  
function file:setvbuf(mode, size) end

---Writes the value of each of its arguments to
---the file.
---The arguments must be strings or numbers.
---To write other values,
---use tostring or string.format before write.
--- ...  
function file:write(...) end

---Equivalent to file:close().
---Without a file, closes the default output file.
---@param file  
function io.close(file) end

---Equivalent to file:flush over the default output file.
function io.flush() end

---When called with a file name, it opens the named file (in text mode),
---and sets its handle as the default input file.
---When called with a file handle,
---it simply sets this file handle as the default input file.
---When called without parameters,
---it returns the current default input file.
---In case of errors this function raises the error,
---instead of returning an error code.
---@param file  
function io.input(file) end

---Opens the given file name in read mode
---and returns an iterator function that,
---each time it is called,
---returns a new line from the file.
---Therefore, the construction
---for line in io.lines(filename) do body end
---
---
---
---will iterate over all lines of the file.
---When the iterator function detects the end of file,
---it returns  nil (to finish the loop) and automatically closes the file.
---The call io.lines() (with no file name) is equivalent
---to io.input():lines();
---that is, it iterates over the lines of the default input file.
---In this case it does not close the file when the loop ends.
---@param filename  
function io.lines(filename) end

---This function opens a file,
---in the mode specified in the string mode.
---It returns a new file handle,
---or, in case of errors,  nil plus an error message.
---The mode string can be any of the following:
---
---  "r"
---read mode (the default);
---  "w"
---write mode;
---  "a"
---append mode;
---  "r+"
---update mode, all previous data is preserved;
---  "w+"
---update mode, all previous data is erased;
---  "a+"
---append update mode, previous data is preserved,
---  writing is only allowed at the end of file.
---
---The mode string can also have a 'b' at the end,
---which is needed in some systems to open the file in binary mode.
---This string is exactly what is used in the
---standard C function fopen.
---@param filename  
---@param mode  
function io.open(filename, mode) end

---Similar to io.input, but operates over the default output file.
---@param file  
function io.output(file) end

---Starts program prog in a separated process and returns
---a file handle that you can use to read data from this program
---(if mode is "r", the default)
---or to write data to this program
---(if mode is "w").
---This function is system dependent and is not available
---on all platforms.
---@param prog  
---@param mode  
function io.popen(prog, mode) end

---Equivalent to io.input():read.
--- ...  
function io.read(...) end

---Returns a handle for a temporary file.
---This file is opened in update mode
---and it is automatically removed when the program ends.
function io.tmpfile() end

---Checks whether obj is a valid file handle.
---Returns the string "file" if obj is an open file handle,
---"closed file" if obj is a closed file handle,
---or  nil if obj is not a file handle.
---@param obj  
function io.type(obj) end

---Equivalent to io.output():write.
--- ...  
function io.write(...) end




return io

<|start_filename|>debugger/debugger.lua<|end_filename|>
local dummy = { }
dummy.error = ''
dummy.start = function()
  print('VSCode debugger hasn\'t started. ' .. dummy.error)
end

if os.getenv('LOCAL_LUA_DEBUGGER_VSCODE') ~= '1' then
  dummy.error = 'This is not a VSCode enviroment or the lldebugger extension is not installed'
  return dummy
end

local debugger_path
for path in package.path:gmatch('([^;]+)') do
  if path:find('local%-lua%-debugger') then
    debugger_path = path:gsub('?.lua', 'lldebugger.lua')
  end
end
if not debugger_path then
  dummy.error = 'Extension local-lua-debugger doesn\'t exist in package.path.'
  return dummy
end

local debugger_file = io.open(debugger_path, 'r')
local is_file_exists = debugger_file ~= nil
if is_file_exists then
  io.close(debugger_file)
else
  dummy.error = 'File doesn\'t exist: ' .. debugger_path
  return dummy
end

local debugger = { }
local module, error = loadfile(debugger_path)
if module then
  package.loaded['lldebugger'] = module()
  local include = require
  debugger = include 'lldebugger'
  return debugger
elseif error then
  dummy.error = 'Loading file error, ' .. error
  return dummy
end



<|start_filename|>.defold-api/message.lua<|end_filename|>
---Messaging API documentation
---Functions for passing messages and constructing URL objects.
---@class msg
msg = {}
---Post a message to a receiving URL. The most common case is to send messages
---to a component. If the component part of the receiver is omitted, the message
---is broadcast to all components in the game object.
---The following receiver shorthands are available:
---
---
--- * "." the current game object
---
--- * "#" the current component
---
--- There is a 2 kilobyte limit to the message parameter table size.
---@param receiver string|url|hash The receiver must be a string in URL-format, a URL object or a hashed string.
---@param message_id string|hash The id must be a string or a hashed string.
---@param message table|nil a lua table with message parameters to send.
function msg.post(receiver, message_id, message) end

---This is equivalent to msg.url(nil) or msg.url("#"), which creates an url to the current
---script component.
---@return url a new URL
function msg.url() end

---The format of the string must be [socket:][path][#fragment], which is similar to a HTTP URL.
---When addressing instances:
---
---
--- * socket is the name of a valid world (a collection)
---
--- * path is the id of the instance, which can either be relative the instance of the calling script or global
---
--- * fragment would be the id of the desired component
---
---In addition, the following shorthands are available:
---
---
--- * "." the current game object
---
--- * "#" the current component
---@param urlstring string string to create the url from
---@return url a new URL
function msg.url(urlstring) end

---creates a new URL from separate arguments
---@param socket string|hash socket of the URL
---@param path string|hash path of the URL
---@param fragment string|hash fragment of the URL
---@return url a new URL
function msg.url(socket, path, fragment) end




return msg

<|start_filename|>.defold-api/http.lua<|end_filename|>
---HTTP API documentation
---Functions for performing HTTP and HTTPS requests.
---@class http
http = {}
---Perform a HTTP/HTTPS request.
--- If no timeout value is passed, the configuration value "network.http_timeout" is used. If that is not set, the timeout value is 0 (which blocks indefinitely).
---@param url string target url
---@param method string HTTP/HTTPS method, e.g. "GET", "PUT", "POST" etc.
---@param callback function(self, id, response) response callback function
---@param headers table optional table with custom headers
---@param post_data string optional data to send
---@param options table optional table with request parameters. Supported entries:
function http.request(url, method, callback, headers, post_data, options) end




return http