Engine
API for engine-related functions.
Constants
Engine.WORLD_FORWARD_DIRECTION
The forward direction of the world.
Engine.WORLD_FORWARD_DIRECTION: vector
Engine.WORLD_UP_DIRECTION
The up direction of the world.
Engine.WORLD_UP_DIRECTION: vector
Engine.WORLD_RIGHT_DIRECTION
The right direction of the world.
Engine.WORLD_RIGHT_DIRECTION: vector
Engine.THIS_REALM
The realm this script is executing in (Menu, Server or Client).
Engine.THIS_REALM: Engine.Realm
Functions
Engine.getCurrentTime
Gets the current time.
Engine.getCurrentTime(): number
Returns
| Name | Type | Description |
|---|---|---|
| time | number | The current time in seconds. |
Engine.quit
Quits the game.
Engine.quit()
Engine.setAddonGlobals
Sets the global environment for addons.
Engine.setAddonGlobals(callback: fun(sandbox: sandbox, require: function): table)
Parameters
| Name | Type | Description |
|---|---|---|
| callback | fun(sandbox: sandbox, require: function): table | The callback which returns the global environment used for addons. |
Engine.addEventListener
Adds an event listener. A list of events can be found here.
Engine.addEventListener(eventType: string, callback: function): function
Parameters
| Name | Type | Description |
|---|---|---|
| eventType | string | The event to listen for. |
| callback | function | The callback to use. |
Returns
| Name | Type | Description |
|---|---|---|
| callback | function | The callback that was registered. |
Engine.removeEventListener
Removes an event listener.
Engine.removeEventListener(eventType: string, callback: function)
Parameters
| Name | Type | Description |
|---|---|---|
| eventType | string | The event to remove the listener from. |
| callback | function | The callback to remove. |
Enums
Realm
The realms or environments in which scripts can execute.
| Value |
|---|
| Menu |
| Server |
| Client |
Events
"tick"
Fires every frame.
Engine.addEventListener("tick", fn(deltaTime) end)
Parameters
| Name | Type | Description |
|---|---|---|
| deltaTime | number | The time in seconds since the last frame. |