Roblox has several unique built-in APIs found in it's Lua environment. These are only found on Roblox, and are not packaged by default with Lua.
|game||A reference to the DataModel, which is the root class of the parent-child hierarchy on Roblox.|
|Enum||A static variable that lets you access all of Roblox's official enums, which are used with various APIs on Roblox.|
|plugin||A variable that is only present when the code is being ran in a plugin. Represents the Plugin object associated with the plugin itself.|
|script||A variable that is only present when the code is being ran by a LuaSourceContainer. This can be either a Script, a LocalScript or a ModuleScript.|
|shared||A table, that is shared with scripts of the same context level. This functions identically to the _G table.|
|workspace||A reference to the Workspace, which is where all physically interactive objects are located.|
|Axes||Allows you to specify what axes should be visible on an ArcHandles object.|
|BrickColor||A list of roughly 200 pre-determined colors that you can apply to BaseParts.|
|CFrame||A means of representing both position, and orientation, as well as relative space between objects.|
|Color3||Allows you to construct any color, with either RGB values, or HSV values.|
|ColorSequence||Represents a sequence of Color3 values and times. Used with the ParticleEmitter class.|
|ColorSequenceKeypoint||Represents a keypoint in a ColorSequence.|
|Faces||Allows you to specify what faces can be dragged with a Handles object.|
|Instance||Allows you to construct most classes that are listed on the API Class reference.|
|NumberRange||Represents a numerical range of values, between the specified Min/Max values.|
|NumberSequence||Represents a sequence of changes to a numerical value over time.|
|NumberSequenceKeypoint||Specifies a time, value, and envelope point in a NumberSequence.|
|PhysicalProperties||Represents the physical properties of a BasePart, which can be changed using the CustomPhysicalProperties property.|
|Ray||Represents a line starting at a 3D point, that travels infinitely in one direction. Used for raycasting.|
|Rect||Represents a rectangular crop when using the SliceCenter GUI feature.|
|Region3||Represents a world-space bounding box, defined by two coordinates. Primarily used with Terrain.|
|Region3int16||Similar to Region3, but uses Vector3int16 coordinates instead of Vector3 coordinates.|
|TweenInfo||Represents information about an in-between interpolation.|
|UDim||Represents a universal dimension, which can dynamically be changed based on the width/height of the screen. Generally overshadowed by UDim2.|
|UDim2||Represents two universal dimensions; one for the X-axis of the user's screen, and one for the Y-axis. Used with GUI elements.|
|Vector2||Represents a two-dimensional coordinate system, on the X/Y axis.|
|Vector3||Represents a three-dimensional coordinate system, on the X/Y/Z axis.|
|Vector3int16||Similar to Vector3, but the coordinates are integers constrained between -32,768 and 32,768, and there are no APIs for magnitude/unit measurement, dot/cross products, or lerping.|
A few quick things to note:
Returns how many seconds have elapsed since the program was started.
Returns a built-in Roblox library, based on the libraryName specified.
The following example iterates over the functions present in the
RbxGui library, and prints the documentation of each function.
Prints the identity level of the current thread to the output.
From a Script:
From the command bar:
From a plugin:
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.
Runs the supplied ModuleScript if it has not been run already, and returns what the ModuleScript returned (in both cases).
--ModuleScript in the workspace print("ModuleScript loaded for the first time") return "Hello, world!"
Returns the user's GlobalSettings.
Returns the number of seconds that have elapsed since the UNIX epoch (January 1st, 1970), on your computer.
Returns the number of seconds that have elapsed since the game started running.
Returns a string representing what kind of object was inputted.
Returns the client's UserSettings.
Returns the string value representation of ROBLOX's version.
Yields the current thread until the specified amount of seconds have elapsed.
If the seconds parameter is not specified, then it yields for a very short period of time (usually close to 1/30th of a second).
The function returns 2 values:
Functions identically to print, except the output is styled as a warning, with yellow text and a timestamp.