Globals
Functions
Function Name | Usage | Description | Notes |
---|---|---|---|
IsInSchedule | bool IsInSchedule() |
||
Wait | number Wait(number time) |
Wait for at least given time interval in seconds then resume execution, and return the exact time taken (which will be the next frame after time seconds). Only valid within a Schedule function |
|
Wait | number Wait() |
Wait a single frame then resume execution, and return the time taken. Only valid within a Schedule function. Example |
|
print(... varArgs) |
Standard print function (same as Print ), takes a comma separated list of arguments and prints out their string representation. |
||
Print(... varArgs) |
Standard print function (same as print ), takes a comma separated list of arguments and prints out their string representation. |
||
printf | printf(string format, ... varArgs) |
This print function replaces instances of {1} in format with the first argument passed in, {2} with the second etc (same as Printf ). |
|
Printf | Printf(string format, ... varArgs) |
This print function replaces instances of {1} in format with the first argument passed in, {2} with the second etc (same as printf ). |
|
FormatString | string FormatString(string format, ... varArgs) |
Format a string using either {1}, {2} as in Printf , etc or using named variables. |
|
GetWorld | World GetWorld() |
Get the World object | |
IsClient | bool IsClient() |
Return true if this script is running on the client | |
IsServer | bool IsServer() |
Return true if this script is running on the server |
Examples
number Wait()
Within a Schedule
function this is how you implement a loop to make something happen every frame and give you a delta of time between the frames for smooth animation:
self:Schedule(
function()
while true do
local dt = Wait() -- wait a frame and return the elapsed time
DoSomething(dt)
end
end
)