Skip to main content

Event

Event is a global class that provides the OnTick function used to call functions every tick.

Event:OnTick(delegate)

Registers the provided function with the tick handler. The provided function will be called every tick.

warning

Performing logic every tick can have a big impact on performance, be careful!

Parameters

ParameterTypeDescription
delegatefunction(gameTime)The function to call every tick.
note

The provided function should accept the gameTime argument to be used with this function

Usage

script.lua
local function printEveryTick(gameTime)
Debug:Print("tick")
end

Event:OnTick(printEveryTick)