From d136845d7193533e30091856285986613593f2a2 Mon Sep 17 00:00:00 2001 From: "services@defold.se" Date: Sun, 26 Jan 2025 18:17:45 +0000 Subject: [PATCH] Site changes [skip-ci] --- manuals/gui-script.md | 2 +- manuals/script.md | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manuals/gui-script.md b/manuals/gui-script.md index d99a9d05a..87539ad31 100644 --- a/manuals/gui-script.md +++ b/manuals/gui-script.md @@ -15,7 +15,7 @@ To control the logic of your GUI and animate nodes you use Lua scripts. GUI scri To add a script to a GUI, first create a GUI script file by right clicking a location in the *Assets* browser and selecting New ▸ Gui Script from the popup context menu. -The editor automatically opens the new script file. It is based on a template and comes equipped with empty lifetime functions, just like game object scripts: +The editor automatically opens the new script file. It is based on a template and comes equipped with empty lifecycle functions, just like game object scripts: ```lua function init(self) diff --git a/manuals/script.md b/manuals/script.md index badc3005b..ca9d4268d 100644 --- a/manuals/script.md +++ b/manuals/script.md @@ -36,7 +36,7 @@ Defold executes Lua scripts as part of the engine lifecycle and exposes the life `self` is a userdata object that acts like a Lua table but you can't iterate over it with `pairs()` or `ipairs()` and you can't print it using `pprint()`. -#### `init(self)` +##### init(self) Called when the component is initialized. ```lua @@ -47,7 +47,7 @@ function init(self) end ``` -#### `final(self)` +##### final(self) Called when the component is deleted. This is useful for cleaning up purposes, for instance if you have spawned game objects that should be deleted when the component is deleted. ```lua @@ -58,7 +58,7 @@ function final(self) end ``` -#### `update(self, dt)` +##### update(self, dt) Called once each frame. `dt` contains the delta time since the last frame. ```lua @@ -67,7 +67,7 @@ function update(self, dt) end ``` -#### `fixed_update(self, dt)` +##### fixed_update(self, dt) Frame-rate independent update. `dt` contains the delta time since the last update. This function is called when `engine.fixed_update_frequency` is enabled (!= 0). Useful when you wish to manipulate physics objects at regular intervals to achieve a stable physics simulation when `physics.use_fixed_timestep` is enabled in *game.project*. ```lua @@ -76,7 +76,7 @@ function fixed_update(self, dt) end ``` -#### `on_message(self, message_id, message, sender)` +##### on_message(self, message_id, message, sender) When messages are sent to the script component through [`msg.post()`](/ref/msg#msg.post) the engine calls this function of the receiver component. Learn [more about message passing](/manuals/message-passing). ```lua @@ -87,7 +87,7 @@ function on_message(self, message_id, message, sender) end ``` -#### `on_input(self, action_id, action)` +##### on_input(self, action_id, action) If this component has acquired input focus (see [`acquire_input_focus`](/ref/go/#acquire_input_focus)) the engine calls this function when input is registered. Learn [more about input handling](/manuals/input). ```lua @@ -98,7 +98,7 @@ function on_input(self, action_id, action) end ``` -#### `on_reload(self)` +##### on_reload(self) This function is called when the script is reloaded through the hot reload editor function (Edit ▸ Reload Resource). It is very useful for debugging, testing and tweaking purposes. Learn [more about hot-reload](/manuals/hot-reload). ```lua