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
Functions
Engine.getWindowSize
Gets the size of the window.
Engine.getWindowSize(): number, number
Returns
Name | Type | Description |
---|---|---|
width | number | The width of the window. |
height | number | The height of the window. |
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: fun(path: string): any): table)
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
callback | fun(sandbox: sandbox, require: fun(path: string): any): table | Required | 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 | Default Value | Description |
---|---|---|---|
eventType | string | Required | The event to listen for. |
callback | function | Required | 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 | Default Value | Description |
---|---|---|---|
eventType | string | Required | The event to remove the listener from. |
callback | function | Required | The callback to remove. |
Events
"tick"
Fires every frame.
Engine.addEventListener("tick", function(deltaTime) end)
Parameters
Name | Type | Description |
---|---|---|
deltaTime | number | The time in seconds since the last frame. |