Roblox Globals
Roblox Globals
Roblox has several unique built-in functions and variables in its Lua implementation. These are only found on Roblox and are not packaged by default with Lua.
Functions
void delay ( number delayTime, function callback ) |
Schedules a function to be executed after delayTime seconds have passed, without yielding the current thread. This function allows multiple Lua threads to be executed in parallel from the same stack. The delay will have a minimum duration of 29 milliseconds, but this minimum may be higher depending on the target framerate and various throttling conditions. If the delayTime parameter is not specified, the minimum duration will be used. |
DebuggerManager DebuggerManager ( ) |
Returns the |
number elapsedTime ( ) |
Returns how much time has elapsed since the current instance of Roblox was started. |
RbxLibrary LoadLibrary ( string libraryName ) |
LoadLibrary cannot be used anymore and will raise an error when called. However, it is still possible to load the modules that this function once did. Please see this announcement post about its removal for more information. You can download this Roblox Model file which contains ModuleScripts that provide equivalent libraries.
Returns a built-in Roblox library, based on the libraryName specified.
There are currently 3 available libraries:
|
PluginManager PluginManager ( ) |
Returns the |
void printidentity ( string prefix = Current identity is ) |
Prints |
Variant require ( ModuleScript module ) |
Runs the supplied If the ModuleScript the user wants to use has been uploaded to Roblox (with the instance’s name being ‘MainModule’), it can be loaded by using the require function on the asset ID of the ModuleScript, though only on the server. |
GlobalSettings settings ( ) |
Returns the |
void spawn ( function callback ) |
Runs the specified callback function in a separate thread, without yielding the current thread.
spawn(print) --> 0.0079617658390703 451.55683163643 |
Stats stats ( ) |
Returns the |
number tick ( ) |
Returns how much time has elapsed, in seconds, since the UNIX epoch, on the current local session’s computer. |
number time ( ) |
Returns the amount of time, in seconds, that has elapsed since the current game instance started running. |
string typeof ( Variant object ) |
Returns the type of the object specified, as a string. |
UserSettings UserSettings ( ) |
Returns the |
string version ( ) |
Returns the current version of Roblox as a string. The integers in the version string are separated by periods, and each integers represent the following, in order: Generation - The current generation of the application shell that is hosting the client. |
number , number wait ( number seconds = 0.03 ) |
Yields the current thread until the specified amount of seconds have elapsed.
|
void warn ( Tuple params ) |
Behaves identically to Lua’s print function, except the output is styled as a warning, with yellow text and a timestamp. |
Variables
Enums Enum |
A reference to the |
DataModel game |
A reference to the |
Plugin plugin |
A reference to the |
array shared |
A table that is shared across all scripts that share the same execution context level. |
LuaSourceContainer script |
A reference to the script object that is executing the code you are writing. |
Workspace workspace |
A reference to the |