-
Notifications
You must be signed in to change notification settings - Fork 2
API ‐ Script Environment
PhoenixWhitefire edited this page Jul 24, 2026
·
47 revisions
Additional types with methods and properties
- An atomic integer, which can be accessed from multiple threads with an ID through
parallel.atomicinteger
- Fetches the value
- Sets the value
- An RGB color
- Returns a Color with the provided R, G, and B values
- Values are expected to be in the range 0 to 1
- This datatype is not hash consed! Two separate value-identical colors are not
rawequaland will not behave as expected when used as table keys
- The Blue channel
- The Green channel
- The Red channel
- Not implemented
- A connection to an Event
- Disconnects the Connection, causing the callback to no longer be queued for resumption. May only be called once. Please note that the callback may still be invoked afterward if the Event occurred before
Disconnecting
- Whether the Connection is connected or not
- The Event which
:Connectwas called upon to return this Connection
- An Event that can be connected to
- This datatype is not hash consed! Two separate value-identical signals are not
rawequaland will not behave as expected when used as table keys (e.g.rawequal(game.OnFrameBegin, game.OnFrameBegin) == false)
- Connect a callback to the Event
- Yields the thread until the Event is fired
- A Game Object
- Game Objects have a "base" API (properties, methods, and events) that can be extended by giving them Components
- The base API will be documented on the Component APIs page
- This datatype is hash consed,
t[game]andt[workspace.Parent]are guaranteed to access the same value asgameandworkspace.Parentarerawequal
- Creates an Object with only the specified Components
- Finds an Object by its internal ID. Do not rely on the ID
- Creates a new Object based on the specified Component, adding additional Components to make it more complete (such as
MeshreceivingMesh,RigidBodyandTransformto make it fully functional)
- A list of all valid component names which can be passed into
.new
- This is a union of
KeyInputEvent,MouseInputEvent, andScrollInputEvent
- A 4x4 transformation matrix
- This datatype is not hash consed! Two separate value-identical matrices are not
rawequaland will not behave as expected when used as table keys
- An identity matrix, the same value as what gets returned with
.new()with no arguments
- Creates a Matrix at position
Eyeoriented such that the.Forwardvector moves towardTarget
Matrix.new(C1R1: number, C2R1: number, C3R1: number, C4R1: number, C1R2: number, C2R2: number, C3R2: number, C4R2: number, C1R3: number, C2R3: number, C3R3: number, C4R3: number, C1R4: number, C2R4: number, C3R4: number, C4R4: number): Matrix
- Returns a new identity matrix when given no arguments, and a matrix with each individual cell set when given 16 number arguments
- Creates a Matrix which has been rotated by the given Euler angles (in radians) with the rotation order Y-X-Z
- Creates a scaled Matrix
- Creates a Matrix which has been translated to the given coordinates (specified as either a
vectoror the individual X, Y, and Z components)
- Extracts the orientation of the Matrix as euler angles in the YXZ rotation order
- Returns the inverse of the Matrix
- Linearly interpolates to the given Matrix
- Constructs a new Matrix with the current Matrix's Translation and Scale, and with the provided Rotation
- Constructs a new Matrix with the current Matrix's Translation and Rotation, and with the provided Scale
- Constructs a new Matrix with the current Matrix's Rotation and Scale, and with the provided Translation
- Add a
vectorto a Matrix to directly offset its position by world space
- Two Matrices, or a Matrix and a
vector, may be multiplied together with the*operator
- Subtract a
vectorfrom a Matrix to directly offset its position by world space
- The value at Column 1, Row 1
- The value at Column 1, Row 2
- The value at Column 1, Row 3
- The value at Column 1, Row 4
- The value at Column 2, Row 1
- The value at Column 2, Row 2
- The value at Column 2, Row 3
- The value at Column 2, Row 4
- The value at Column 3, Row 1
- The value at Column 3, Row 2
- The value at Column 3, Row 3
- The value at Column 3, Row 4
- The value at Column 4, Row 1
- The value at Column 4, Row 2
- The value at Column 4, Row 3
- The value at Column 4, Row 4
- The Forward basis vector of the Matrix
- The Right basis vector of the Matrix
- The current scale of the Matrix
- The translation of the Matrix
- The Up basis vector of the Matrix
- A mutex which can be fetched with an ID through
parallel.mutex
- Attempts to lock the mutex if it is not already locked by another thread. Returns whether or not the locking succeeded
- Not implemented
- A buffer accessible without locking between mulitple parallel threads, which can be fetched through
parallel.sharedbuffer
Pull(SharedBuffer, Start: number | --[[integer |]] nil, Length: number | --[[integer |]] nil) -> buffer
- Copies a section of the shared buffer into a regular
bufferobject
Push(SharedBuffer, Source: buffer, Start: number | --[[integer |]] nil, Length: number | --[[integer |]] nil) -> ()
- Copies a
bufferinto the shared buffer. If noLengthis provided, then the full length of the source buffer is copied
- Size of the buffer, in bytes
- Not implemented
Libraries specific to the Phoenix Engine Luau runtime
- Contains enumerations
- See the Enums page for details
- Describes the Luau runtime
- The name of the runtime
- URL associated with the runtime
- Version information
- Extensions to the standard Luau
debuglibrary are documented below
- Set a breakpoint at the closest possible line to the given target line within the calling function, returning the actual line the breakpoint landed on
- If a line is not specified, breaks into Debugger immediately, and returns no values
- If a Debugger is not attached (such as in non-developer mode or headless mode), has no effect
- Generates a profiler log message event
- Begins a profiling zone for the current function, optionally accepting a name
- Ends the last profiling zone
- Set additional debug text for the zone
- Interacting with the player's filesystem
- Several aliases may be used with functions in this library, these are unrelated to
requirealiases although the same syntax is used - The following aliases are provided as part of the API:
-
-
self: The current script file
-
-
-
selfdir: The containing directory of the current script file
-
-
-
project: Path to the current project folder
-
-
-
home: The player's user profile directory
-
-
-
plugin: Only valid in Editor plugins. The directory of the plugin, if it is not a single-file.luau
-
- These may be used in a manner such as
fs.write("@project/savefile.json", saveData) - Other aliases may also exist, however they are strictly internal and should not be explicitly used
- Avoid overwriting the
basealias as this may cause certain default assets to stop loading - Aliases beginning with
_may only be defined or remove by the root Luau VM
- Copies the file/directory at the given path to a new path
- If unsuccessfully, throws an error message
- Returns the Current Working Directory of the Engine
- Defines an alias for the filesystem, such that
@<Alias>/refers to<For>/to the Engine
- Executes a shell command
- Fetches the user's 'home' or profile directory
- Returns the Current Working Directory if it cannot be determined
- Returns whether the specified Path refers to a directory
- Returns whether the specified Path refers to a file
- Returns whether the node at the specified path is a symbolic link
- Returns the timestamp for when the file was last modified, in seconds since epoch
- Returns a table of all the entries in the specified directory
- The keys of the table is the path of the entry, while the values are the type of the entry
-
fis file,dis directory, andais all
- Creates a directory at the given path
- Throws an error upon failure
- Moves a file or folder to a new path
fs.promptopen(DefaultLocation: string? [ './' ], Filter: ( { string } | string)? [ '*.*' ], FilterName: string? [ 'All files' ], AllowMultipleFiles: boolean? [ false ]): { string }
- Prompts the player to select a file to open
- Returns the list of files the player selected, or an empty list if the player cancelled the dialog
- If the operation fails, returns
nilinstead
- Prompts the user to select a folder
- Returns
nilif no selection was made
fs.promptsave(DefaultLocation: string? [ './' ], Filter: ( { string } | string)? [ '*.*' ], FilterName: string? [ 'All files' ]): string?
- Prompts the player to select a path to save a file to
- Returns the path the player selected, or
nilif they cancelled the dialog
- Reads the file at the given address, and returns the contents
- If the file could not be read, returns
niland an error message
- Returns what the target of the symlink at the given path is
- Removes everything at the given path
- Throws an error upon failure
- Removes an alias previously defined with
fs.definealias
- Renames the file at the given
Pathto have theNewName - Throws an error upon failure
fs.resolvepath(Path: string) -> string* Resolves the aliases of the path, converting it into the form ./path or leaving it as another qualified variant
fs.resolvepathabsolute(Path: string) -> string* Same asfs.resolvepath, however converts path in the CWD-relative form (./path) to be absolute (relative to system root directory)
- Changes the meaning of non-qualified paths (e.g.: not beginning with
.orC:etc) to act as aliases to the given path +resources/instead of referring to the CWD - The default is
./
- Creates a symlink at
Pathreferring toTarget
- Opens the given path with the system's registered handler
- Can be a path to a folder, a file, or a URL
- Watch a file or directory for changes
- Returns a function that, when called, disconnects the listener
- Overwrites/creates the file at
Pathwith the providedContents - Throws an error upon failure
- If
CreateDirectoriesistrue, will automatically create missing intermediate directories to the file
- UI with Dear ImGui
ImGui::IsAnyItemActive
imgui.begin(WindowTitle: string, WindowFlags: string? [ "" ], HasCloseButton: boolean? [ false ]): boolean, boolean
ImGui::Begin-
WindowFlagsmay be a combination of any of the following sequences, optionally separated by ' ' or '|' characters:nt(no titlebar),nr(no resize),nm(no move),nc(no collapse),ns(no saved settings),ni(no interact),h(horizontal scrolling)
imgui.beginchild(Name: string, Size: vector? [ 0, 0 ], ChildFlags: string? [ "" ], WindowFlags: string? [ "" ]): boolean
ImGui::BeginChild-
ChildFlagsmay be a combination of any of the following sequences, optionally separated by ' ' or '|' characters:b(borders),wp(always use window padding),rx(resize X),ry(resize Y),ax(auto resize X),ay(auto resize Y),f(frame style) -
WindowFlagsmay be a combination of any of the following sequences, optionally separated by ' ' or '|' characters:nt(no titlebar),nr(no resize),nm(no move),nc(no collapse),ns(no saved settings),ni(no interact),h(horizontal scrolling)
- Creates a Dear ImGui window which takes up the entire screen
ImGui::BeginMainMenuBar
ImGui::BeginMenu
ImGui::BeginMenuBar
ImGui::BeginPopup
ImGui::BeginPopupModal
ImGui::BeginTooltip
ImGui::Button
ImGui::Checkbox
ImGui::CloseCurrentPopup
ImGui::CollapsingHeader
ImGui::Combo- Returns the selected option index, as well as whether the option was changed
ImGui::GetContentRegionAvail
- Returns the current position of the Dear ImGui element cursor within the current window
- To set the cursor position, use
.setcursorposition
- Renders the Dear ImGui demo window (
ImGui::ShowDemoWindow)
ImGui::Dummy
ImGui::EndChild
ImGui::EndMainMenuBar
ImGui::EndMenu
ImGui::EndMenuBar
ImGui::EndPopup
ImGui::EndTooltip
-
ImGui::End,endwand notendbecauseendis a Luau keyword
ImGui::SetKeyboardFocusHere
ImGui::GetScrollMaxX
ImGui::GetScrollMaxY
ImGui::GetScrollX
ImGui::GetScrollY
- Gets the current applied style color for a given style token as an array of 4 numbers for RGBA
imgui.image(ImagePath: string, Size: vector?, FlipVertically: boolean? [ false ], TintColor: { number }? [ { 1, 1, 1, 1 } ], LinearlySmooth: boolean? [ true ])
ImGui::Image
ImGui::ImageButton
ImGui::Indent
ImGui::InputDouble
ImGui::InputText
ImGui::IsPopupOpen
ImGui::IsItemActive
ImGui::IsItemClicked
ImGui::IsItemDeactivatedAfterEdit
ImGui::IsItemHovered
ImGui::MenuItem
ImGui::Newline
ImGui::OpenPopup
ImGui::PopID
ImGui::PopStyleColor
ImGui::PushID
ImGui::PushStyleColor-
Coloris an array with 4 numbers representing R, G, B, and A
ImGui::RadioButton
ImGui::ColorEdit4- The table should have exactly 4 elements
- Note that this edits the table in-place
ImGui::ColorEdit3- The table should have exactly 3 elements
- Note that this edits the table in-place
ImGui::SameLine
- UI scale factor
ImGui::SetScrollHereX
ImGui::SetScrollHereY
ImGui::Separator
ImGui::SeparatorText
imgui.setcursorposition((Position: vector) -> ()) & ((X: number, Y: number) -> ())* Sets the position of the Dear ImGui element cursor within the current window
ImGui::SetItemTooltip
- Forces the state of the next item to be open or closed
ImGui::SetNextItemOpen
- Sets the width of the next item
ImGui::SetNextItemWidth
ImGui::SetNextWindowFocus
ImGui::SetNextWindowCollapsed(!Open)
- `ImGui::SetNextWindowPos
ImGui::SetNextWindowSize
- Directly sets a style color. "Colors" are 4-channel RGBA
ImGui::SetTooltip
- Sets the region of the window in which Dear ImGui windows can be docked
- Reverts the region of the window in which Dear ImGui windows can be docked to the default settings
-
ImGui::StyleColorsDark/ImGui::StyleColorsLight/ImGui::StyleColorsClassic
ImGui::Text
ImGui::TextLink
ImGui::CalcTextSize
ImGui::TreeNode- Accepts flags:
sl- Selected,sc- Span All Columns,fr- Framed,fw- Span Full Width,ao- Allow Overlap,ar- Open on Arrow,aw- Span Available Width,np- No Tree Push On Open,do- Default Open,dc- Open On Double Click,dlx- Draw Lines None,dln- Draw Lines to Nodes,dlf- Draw Lines Full,lf- Leaf,lw- Span Label Width,lsc- Span All Columns,b- Bullet,p- Frame Padding,c- Collapsing Header.and|are considered whitespace
ImGui::TreePop
- Similar to
imgui.textlink, however, will open the given URL upon being clicked -
Urlwill beTextif not provided ImGui::TextLinkOpenUrl
ImGui::WindowAppearing
ImGui::IsWindowHovered
- Returns the position of the current Dear ImGui window (
ImGui::GetWindowPos) - To set the position of the window, use
.setnextwindowposition
- Returns the size of the current window
- Encoding and decoding JSON files
- Encodes the provided value into a JSON string. The default indentation is 2 spaces
- Decodes the JSON string and returns it as a value
- Parallelization of Luau
- Creates/finds an atomic integer with a matching ID
- Yields the thread until the parallel phase
- Create/find a mutex
- Create/find a shared buffer
- Spawns a new parallel routine in a parallel VM
- Passed arguments will be available to the spawned script through
...in the top-level scope
- Yields the thread until the serial phase
- Returns whether the current thread is synchronized with the main thread
- Scheduling of tasks (coroutines or functions)
- Schedules the given function or coroutine to be resumed at the next scheduler step
- Schedules the given function or coroutine to be resumed some number of seconds later
- Like
loadstringin other runtimes, however does not compromise Global Import optimizations and returns a coroutine instead of a function - If an error occurs, returns
nilas the first value and the error message as the second value
- Similar to
loadthread, however loads from a file instead of from a string directly
- Sets a global for a given coroutine
- Yields the thread for the specified number of seconds. Default is
0
Additional global variables
- A non-unique identifier for the current Luau VM
- Same as
print, but does not prefix the log message with[INFO]
- The GameObject acting as the Data Model of the Engine
- Same as
print, except generates a Warning message
- Shorthand for
game.Workspace