Module components_script
Base component providing script lifecycle hooks.
Info:
- Author: Sharper Dev
Functions
| Script:new () | Creates an enabled script component. |
| Script:destroy () | Clears the script's enabled state and lifecycle hooks when destroyed. |
| Script.start () | Lifecycle hook for one-time initialization when the component starts. |
| Script.update () | Lifecycle hook called each frame. |
Functions
- Script:new ()
-
Creates an enabled script component.
Returns:
-
table The new Script component.
Usage:
local script = gameObject:addComponent("Script")
- Script:destroy ()
- Clears the script's enabled state and lifecycle hooks when destroyed.
- Script.start ()
-
Lifecycle hook for one-time initialization when the component starts.
Usage:
function script:start() -- Code here end
- Script.update ()
-
Lifecycle hook called each frame.
Usage:
function script:update() -- Code here end