update rules

This commit is contained in:
Joe 2026-02-02 14:05:11 -06:00
parent 4c390fdd37
commit d5522b2fef
8549 changed files with 11783 additions and 1888 deletions

View file

@ -0,0 +1,878 @@
# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Luau globals
type: global
summary: |
A list of functions and variables that are native to Luau.
description: |
The following is a list of functions and variables that are native to Luau.
These functions can be used in a standard installation of both
[Luau](https://luau.org) and [Lua 5.1.4](https://www.lua.org/manual/5.1/),
though there are some differences in how some of these work on Roblox.
tags: []
code_samples: []
properties:
- name: _G
type: Array
summary: |
A table that is shared between all scripts of the same context level.
description: |
A table that is shared between all scripts of the same context level.
tags: []
code_samples: []
deprecation_message: ''
- name: _VERSION
type: string
summary: |
A global variable that holds a string containing the current interpreter
version.
description: |
A global variable (not a function) that holds a string containing the
current interpreter version.
tags: []
code_samples: []
deprecation_message: ''
functions:
- name: assert
summary: |
Throws an error if the provided `value` resolves to `false` or `nil`.
description: |
Throws an error if the provided `value` is `false` or `nil`. If the
assertion passes, it returns all values passed to it.
```lua
local product = 90 * 4
assert(product == 360, "Oh dear, multiplication is broken")
-- The line above does nothing, because 90 times 4 is 360
```
parameters:
- name: value
type: Variant
default:
summary: |
The value that will be asserted against.
- name: errorMessage
type: string
default: assertion failed!
summary: |
The text that will be shown in the error if the assertion fails.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: collectgarbage
summary: |
Performs the specified operation of the garbage collector.
description: |
Performs the specified operation of the garbage collector. Note that
Roblox's Luau sandbox only allows the `count` option to be used (the total
memory in use by Luau, in kilobytes), as other options can interfere with
existing processes. Effectively, this makes `Global.LuaGlobals.gcinfo()` a
superior alternative that should be used instead.
parameters:
- name: operation
type: string
default:
summary: |
The name of the operation that should be performed by the garbage
collector.
returns:
- type: Variant
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: ''
- name: error
summary: |
Halts thread execution and throws an error.
description: |
Terminates the last protected function called and outputs `message` as an
error message. If the function containing the error is not called in a
protected function such as `pcall()`, then the script which called the
function will terminate. The error function itself never returns and acts
like a script error.
The `level` argument specifies how to get the error position. With level
`1` (the default), the error position is where the error function was
called. Level 2 points the error to where the function that called error
was called; and so on. Passing a level `0` avoids the addition of error
position information to the message.
parameters:
- name: message
type: Variant
default:
summary: |
The error message to display.
- name: level
type: int
default: 1
summary: |
The level of information that should be printed. Defaults to 1.
returns:
- type: ()
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: gcinfo
summary: |
Returns the total memory heap size in kilobytes.
description: |
Returns the total memory heap size in kilobytes. The number reflects the
current heap consumption from the operating system perspective, which
fluctuates over time as garbage collector frees objects.
parameters: []
returns:
- type: number
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: getfenv
summary: |
Returns the current environment in use by the caller, as a dictionary.
description: |
Returns the current environment in use by the caller, as a dictionary.
- If provided with a function, the environment of the function will be
returned.
- If provided with an integer, `Global.LuaGlobals.getfenv()` will provide
the environment of the function at the provided stack level: Level 1 is
the function calling `Global.LuaGlobals.getfenv()`. If `stack` is `0`,
`Global.LuaGlobals.getfenv()` returns the global environment of the
current script. When using `Global.LuaGlobals.getfenv()` to get the
current environment of a script, it will return the same table every
time within the specific thread.
**WARNING:** This function allows uncontrolled change of the
global/function environment and disables script optimizations. Changes to
the environment are not tracked by the script analysis tooling and may
result in missing or incorrect warnings. As a replacement, consider using
`Library.debug.info()` instead.
parameters:
- name: stack
type: Variant
default: 1
summary: |
The stack level (int) of the environment to be returned; or the
function whose environment will be returned.
returns:
- type: table
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
This function allows uncontrolled change of the global/function
environment and disables script optimizations. Changes to the environment
are not tracked by the script analysis tooling and may result in missing
or incorrect warnings. As a replacement, consider using
`Library.debug.info()` instead.
- name: getmetatable
summary: |
Returns the metatable of the given table.
description: |
Returns the metatable of the given table `t` if it has one, otherwise
returns `nil`. If `t` does have a metatable, and the `__metatable`
metamethod is set, it returns that value instead.
```lua
-- Demonstrate getmetatable:
local meta = {}
local t = setmetatable({}, meta)
print(getmetatable(t) == meta) --> true
-- Make the original metatable unrecoverable by setting the __metatable metamethod:
meta.__metatable = "protected"
print(getmetatable(t)) --> protected
```
parameters:
- name: t
type: Variant
default:
summary: |
The object to fetch the metatable of.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: ipairs
summary: |
Returns an iterator function and the table for use in a for loop.
description: |
Returns three values: an iterator function, the table `t` and the number
`0`. Each time the iterator function is called, it returns the next
numerical index-value pair in the table. When used in a generic for-loop,
the return values can be used to iterate over each numerical index in the
table:
```lua
local fruits = {"apples", "oranges", "kiwi"}
for index, fruit in ipairs(fruits) do
print(index, fruit) --> 1 apples, 2 oranges, 3 kiwi, etc...
end
```
parameters:
- name: t
type: Array
default:
summary: |
A table whose elements are to be iterated over.
returns:
- type: function
summary: ''
- type: Array
summary: ''
- type: int
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: loadstring
summary: |
Returns the provided code as a function that can be executed.
description: |
Loads Luau code from a string and returns it as a function.
Unlike standard Lua 5.1, Roblox's Luau cannot load the compiled bytecode
using `loadstring()`.
`loadstring()` is disabled by default. For guidance around enabling it,
see `Class.ServerScriptService`.
**WARNING:** This method disables certain Luau optimizations on the
returned function. Extreme caution should be taken when using
`Global.LuaGlobals.loadstring()`; if your intention is to allow users to
run code in your experience, make sure to protect the returned function's
environment by using `Global.LuaGlobals.getfenv()` and
`Global.LuaGlobals.setfenv()`.
parameters:
- name: contents
type: string
default:
summary: |
The specified string to be loaded as Luau code.
- name: chunkname
type: string
default:
summary: |
An optional chunk name for error messages and debug information. If
unspecified, Luau uses the `contents` string.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: newproxy
summary: |
Creates a blank `userdata`, with the option for it to have a metatable.
description: |
Creates a blank `userdata`, with the option for it to have a metatable.
parameters:
- name: addMetatable
type: bool
default: false
summary: ''
returns:
- type: userdata
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: next
summary: |
An iterator function for use in for loops.
description: |
Returns the first key/value pair in the array. If a `lastKey` argument was
specified then returns the next element in the array based on the key that
provided. The order in which the indices are enumerated is not specified,
even for numeric indices. To traverse a table in numeric order, use a
numerical for loop or `ipairs`.
The behavior of next is undefined if, during the traversal, you assign any
value to a non-existent field in the table. You may, however, modify
existing fields. In particular, you may clear existing fields.
parameters:
- name: t
type: table
default:
summary: |
The array to be traversed.
- name: lastKey
type: Variant
default: nil
summary: |
The last key that was previously retrieved from a call to next.
returns:
- type: Variant
summary: ''
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: pairs
summary: |
Returns an iterator function and the provided table for use in a `for`
loop.
description: |
Returns an iterator function, the passed table `t`, and `nil`, so that the
construction will iterate over all key/value pairs of that table when used
in a generic `for` loop:
```lua
local scores = {
["John"] = 5,
["Sally"] = 10
}
for name, score in pairs(scores) do
print(name .. " has score: " .. score)
end
```
parameters:
- name: t
type: table
default:
summary: |
An array or dictionary table to iterate over.
returns:
- type: function
summary: ''
- type: table
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: pcall
summary: |
Runs the provided function and catches any error it throws, returning the
function's success and its results.
description: |
Calls the function `func` with the given arguments in protected mode. This
means that any error inside `func` is not propagated; instead, `pcall()`
catches the error and returns a status code. Its first result is the
status code (a boolean), which is true if the call succeeds without
errors. In such case, `pcall()` also returns all results from the call,
after this first result. In case of any error, `pcall()` returns false
plus the error message.
```lua
local function divideByFive(n: number): number
return n / 5
end
local success, errorMessage = pcall(divideByFive, "notANumber") -- Results in error...
if success then
-- Handle successful response...
else
warn("Error message:", errorMessage)
end
```
parameters:
- name: func
type: function
default:
summary: |
The function to be called in protected mode.
- name: args
type: Tuple
default:
summary: |
The arguments to send to `func` when executing.
returns:
- type: bool
summary: ''
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: print
summary: |
Prints all provided values to the output.
description: |
Receives any number of arguments, and prints their values to the output.
`print` is not intended for formatted output, but only as a quick way to
show a value, typically for debugging. For a formatted output, use
`Library.string.format()`. On Roblox, `print` does not call `tostring`,
but the `__tostring` metamethod still fires if the table has one.
parameters:
- name: params
type: Tuple
default:
summary: |
Any number of arguments to be outputted.
returns:
- type: ()
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: rawequal
summary: |
Returns whether `v1` is equal to `v2`, bypassing their metamethods.
description: |
Checks whether `v1` is equal to `v2`, without invoking any metamethods.
parameters:
- name: v1
type: Variant
default:
summary: |
The first variable to compare.
- name: v2
type: Variant
default:
summary: |
The second variable to compare.
returns:
- type: bool
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: rawget
summary: |
Gets the real value of `table[index]`, bypassing any metamethods.
description: |
Gets the real value of `table[index]`, without invoking any metamethods.
parameters:
- name: t
type: table
default:
summary: |
The table to be referenced.
- name: index
type: Variant
default:
summary: |
The index to get from `t`.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: rawlen
summary: |
Returns the length of the string or table, bypassing any metamethods.
description: |
Returns the length of the string or table, without invoking any
metamethods.
parameters:
- name: t
type: table
default:
summary: |
The table to be referenced.
returns:
- type: table
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: rawset
summary: |
Sets the real value of `table[index]`, bypassing any metamethods.
description: |
Sets the real value of `table[index]` to a given `value`, without invoking
any metamethod.
parameters:
- name: t
type: table
default:
summary: |
The table to be referenced.
- name: index
type: Variant
default:
summary: |
The index to set in `t` to a specified `value`. Must be different from
`nil`.
- name: value
type: Variant
default:
summary: |
The value to be set to a specified `index` in table `t`.
returns:
- type: table
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: require
summary: |
Returns the value that was returned by the given ModuleScript, running it
if it has not been run yet.
description: |
Runs the supplied `Class.ModuleScript` and returns what the
`Class.ModuleScript` returned (usually a table or a function). If the
`Class.ModuleScript` has not been run yet, it will be executed.
If a string path is provided instead, it is first resolved to a
`Class.ModuleScript` relative to the script that called
`Global.LuaGlobals.require()`, mimicking the Unix-like semantics of Luau's
`require()` expression.
Specifically, require-by-string's resolution semantics are as follows:
- Paths with the `./` prefix begin resolution at `script.Parent`.
- Paths with the `../` prefix begin resolution at `script.Parent.Parent`.
- Paths with the `@self/` prefix begin resolution at `script`.
- Paths with the `@game/` prefix begin resolution at `game`.
- Each non-prefix component in a given path corresponds to a child
instance of the previous component. The exception to this is the `..`
component, which corresponds to the parent of the previous component.
- If the desired `Class.ModuleScript` is not present at the time that
`Global.LuaGlobals.require()` is called, the call will fail and throw an
error. In other words, require-by-string is non-blocking: it does not
implicitly wait for a `Class.ModuleScript` to be created.
To illustrate this, each pair of `Global.LuaGlobals.require()` expressions
in the example below contains two functionally equivalent calls. Redundant
parentheses have been added to clarify exactly how each path component
maps onto an instance.
```lua
-- "./" prefix is equivalent to script.Parent
require("./MySibling")
require((script.Parent).(MySibling))
-- "../" prefix is equivalent to script.Parent.Parent
require("../SiblingOfMyParent")
require((script.Parent.Parent).(SiblingOfMyParent))
-- "../" can be chained to go up multiple levels
require("../../SiblingOfMyGrandparent")
require((script.Parent.Parent).(Parent).(SiblingOfMyGrandparent))
-- "@self" prefix corresponds to the script itself
require("@self/MyChild")
require((script).(MyChild))
-- "@game" prefix corresponds to the DataModel root
require("@game/ReplicatedStorage/Shared/MyModule")
require((game).(ReplicatedStorage).(Shared).(MyModule))
```
Once the return object is created by an **initial**
`Global.LuaGlobals.require()` call of a `Class.ModuleScript`, future
`Global.LuaGlobals.require()` calls for the same `Class.ModuleScript` (on
the same side of the client-server boundary) will not run the code again.
Instead, a reference to the **same** return object created by the initial
`Global.LuaGlobals.require()` call will be supplied. This behavior allows
for the sharing of values across different scripts, as multiple
`Global.LuaGlobals.require()` calls from different scripts will reference
the same returned object. If the returned object is a table, any values
stored within the table are shared and accessible by any script requiring
that `Class.ModuleScript`.
As noted above, the "object sharing" behavior does not cross the
client-server boundary. This means that if a `Class.ModuleScript` is
accessible to both the client **and** server (such as by being placed in
`Class.ReplicatedStorage`) and `Global.LuaGlobals.require()` is called
from both a `Class.LocalScript` as well as a `Class.Script`, the code in
the `Class.ModuleScript` will be run twice, and the `Class.LocalScript`
will receive a distinct return object from the one received by the
`Class.Script`.
Also note that if the `Class.ModuleScript` the user wants to run has been
uploaded to Roblox (with the instance's name being `MainModule`), it can
be loaded by using the `Global.LuaGlobals.require()` function on the asset
ID of the `Class.ModuleScript`, though only on the server.
parameters:
- name: module
type: ModuleScript | string | number
default:
summary: |
The `Class.ModuleScript` that will be executed to retrieve the return
value it provides, or a reference to one (a string path or asset ID).
returns:
- type: Variant
summary: |
What the `Class.ModuleScript` returned (usually a table or a
function).
tags: []
code_samples: []
deprecation_message: ''
- name: select
summary: |
Returns all arguments after the given index.
description: |
Returns all arguments after argument number `index`. If negative, it will
return from the end of the argument list.
```lua
print(select(2, "A", "B", "C")) --> B C
print(select(-1, "A", "B", "C")) --> C
```
If the `index` argument is set to `"#"`, the number of arguments that were
passed after it is returned.
```lua
print(select("#", "A", "B", "C")) --> 3
```
parameters:
- name: index
type: Variant
default:
summary: |
The index of the argument to return all arguments after in `args`. If
it's set to `"#"`, the number of arguments that were passed after it
is returned.
- name: args
type: Tuple
default:
summary: |
A tuple of arguments.
returns:
- type: Tuple
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: setfenv
summary: |
Sets the given function's environment.
description: |
Sets the environment to be used by the given function. `f` can be a
function or a number that specifies the function at that stack level:
Level 1 is the function calling `setfenv()`. `setfenv()` returns the given
function.
If `f` is `0`, then `setfenv()` changes the environment of the running
thread and returns no values.
**WARNING:** This function allows uncontrolled change of the
global/function environment and disables script optimizations. Changes to
the environment are not tracked by the script analysis tooling and may
result in missing or incorrect warnings.
parameters:
- name: f
type: Variant
default:
summary: |
Either a function or a number that specifies the function at that
stack level.
- name: fenv
type: table
default:
summary: |
The function environment table to set for the specified function.
returns:
- type: Variant
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
This function allows uncontrolled change of the global/function
environment and disables script optimizations. Changes to the environment
are not tracked by the script analysis tooling and may result in missing
or incorrect warnings.
- name: setmetatable
summary: |
Sets the given table's metatable.
description: |
Sets the metatable for the given table `t` to `newMeta`. If `newMeta` is
`nil`, the metatable of `t` is removed. Finally, this function returns the
table `t` which was passed to it. If `t` already has a metatable whose
`__metatable` metamethod is set, calling this on `t` raises an error.
```lua
local meta = {__metatable = "protected"}
local t = {}
setmetatable(t, meta) -- This sets the metatable of t
-- We now have a table, t, with a metatable. If we try to change it...
setmetatable(t, {}) --> Error: cannot change a protected metatable
```
parameters:
- name: t
type: table
default:
summary: |
The table to set the metatable of.
- name: newMeta
type: Variant
default:
summary: |
If `nil`, the metatable of the given table `t` is removed. Otherwise,
the metatable to set for the given table `t`.
returns:
- type: table
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: tonumber
summary: |
Returns the provided value converted to a number, or `nil` if impossible.
description: |
Attempts to convert the arg into a number with a specified base to
interpret the value in. If it cannot be converted, this function returns
`nil`.
The base may be any integer between 2 and 36, inclusive. In bases above
10, the letter 'A' (in either upper or lower case) represents 10, 'B'
represents 11, and so forth, with 'Z' representing 35. In base 10 (the
default), the number may have a decimal part, as well as an optional
exponent part. In other bases, only unsigned integers are accepted.
If a string begins with `0x` and a base is not provided, the `0x` is
trimmed and the base is assumed to be 16, or hexadecimal.
```lua
print(tonumber("1337")) --> 1337 (assumes base 10, decimal)
print(tonumber("1.25")) --> 1.25 (base 10 may have decimal portions)
print(tonumber("3e2")) --> 300 (base 10 may have exponent portion, 3 × 10 ^ 2)
print(tonumber("25", 8)) --> 21 (base 8, octal)
print(tonumber("0x100")) --> 256 (assumes base 16, hexadecimal)
print(tonumber("roblox")) --> nil (does not raise an error)
-- Tip: use with assert if you would like unconvertable numbers to raise an error
print(assert(tonumber("roblox"))) --> Error: assertion failed
```
parameters:
- name: arg
type: Variant
default:
summary: |
The object to be converted into a number.
- name: base
type: int
default: 10
summary: |
The numerical base to convert `arg` into.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: tostring
summary: |
Returns the provided value converted to a string, or `nil` if impossible.
description: |
Receives an argument of any type and converts it to a string in a
reasonable format. For complete control of how numbers are converted, use
string.format. If the metatable of `e` has a `__tostring` metamethod, then
it will be called with `e` as the only argument and will return the
result.
```lua
local isRobloxCool = true
-- Convert the boolean to a string then concatenate:
print("Roblox is cool: " .. tostring(isRobloxCool)) --> Roblox is cool: true
```
parameters:
- name: e
type: Variant
default:
summary: |
The object to be converted into a string.
returns:
- type: string
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: type
summary: |
Returns the basic type of the provided object.
description: |
Returns the type of its only argument, coded as a string. The possible
results of this function are `"nil"` (a string, not the value nil),
`"number"`, `"string"`, `"boolean"`, `"table"`, `"vector"`, `"function"`,
`"thread"`, `"userdata"`, and `"buffer"`. The `buffer` and `vector`
primitives are additions from Luau, not from Lua.
parameters:
- name: v
type: Variant
default:
summary: |
The object to return the type of.
returns:
- type: string
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: unpack
summary: |
Returns all elements from the given list as a tuple.
description: |
Returns the elements from the given table. By default, `i` is 1 and `j` is
the length of `list`, as defined by the length operator.
parameters:
- name: list
type: table
default:
summary: |
The list of elements to be unpacked.
- name: i
type: int
default: 1
summary: |
The index of the first element to unpack.
- name: j
type: int
default: '#list'
summary: |
The index of the last element to unpack.
returns:
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: xpcall
summary: |
Similar to `Global.LuaGlobals.pcall()` except it uses a custom error
handler.
description: |
This function is similar to `Global.LuaGlobals.pcall()`, except that you
can set a new error handler.
`xpcall()` calls function `f` in protected mode, using `err` as the error
handler, and passes a list of arguments. Any error inside `f` is not
propagated; instead, `xpcall()` catches the error, calls the `err`
function with the original error object, and returns a status code. Its
first result is the status code (a boolean), which is true if the call
succeeds without errors. In this case, `xpcall()` also returns all results
from the call, after this first result. In case of any error, `xpcall()`
returns false plus the result from `err`.
Unlike `Global.LuaGlobals.pcall()`, the `err` function preserves the stack
trace of function `f`, which can be inspected using `Library.debug.info()`
or `Library.debug.traceback()`.
parameters:
- name: f
type: function
default:
summary: |
The function to be called in protected mode.
- name: err
type: function
default:
summary: |
The function to be used as an error handle if xpcall catches an error.
- name: args
type: Tuple
default:
summary: ''
returns:
- type: bool
summary: ''
- type: Variant
summary: ''
tags: []
code_samples: []
deprecation_message: ''

View file

@ -0,0 +1,439 @@
# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Roblox globals
type: global
summary: |
Built-in functions and constants unique to Roblox.
description: |
Roblox provides several unique built-in functions and variables in its
embedding of Luau. These are only found on Roblox and are not packaged by
default with Luau or Lua.
tags: []
code_samples: []
properties:
- name: Enum
type: Enums
summary: |
Contains all Enum objects.
description: |
A reference to the Enums data type, which stores all of the available
enums that can be used on Roblox.
tags: []
code_samples: []
deprecation_message: ''
- name: game
type: DataModel
summary: |
Refers to the DataModel singleton, the root instance of a place's
hierarchy.
description: |
A reference to the `Class.DataModel`, which is the root Instance of
Roblox's parent/child hierarchy.
tags: []
code_samples: []
deprecation_message: ''
- name: plugin
type: Plugin
summary: |
Refers to a Plugin singleton when the code is run in the context of a
Studio plugin.
description: |
A reference to the `Class.Plugin` object that represents the plugin being
run from this `Class.Script`. This reference exists only in the context
where a script is executed as a plugin and is not passed to
`Class.ModuleScript|ModuleScripts` within the plugin. To use this
reference in a `Class.ModuleScript`, you must explicitly pass it.
```lua
assert(plugin, "This script must be run as a plugin!")
-- Code beyond this point will execute only if the script is run as a plugin
```
tags: []
code_samples: []
deprecation_message: ''
- name: shared
type: Array
summary: |
A table shared between all code running at the same execution context
level.
description: |
A table that is shared across all scripts that share the same execution
context level. This serves the exact same purpose as `_G`.
tags: []
code_samples: []
deprecation_message: ''
- name: script
type: LuaSourceContainer
summary: |
A reference to the LuaSourceContainer object (Script, LocalScript, or
ModuleScript) that is executing this code.
description: |
A reference to the script object that is executing the code you are
writing. It can be either a `Class.Script`, a `Class.LocalScript`, or a
`Class.ModuleScript`. This variable is not available when executing code
from Roblox Studio's command bar.
tags: []
code_samples: []
deprecation_message: ''
- name: workspace
type: Workspace
summary: |
A reference to the Workspace service, which contains all of the physical
components of a place.
description: |
A reference to the `Class.Workspace` service, which contains all of the
physical components of a Roblox world.
tags: []
code_samples: []
deprecation_message: ''
functions:
- name: delay
summary: |
Schedules a function to be called on the next Heartbeat after the given
duration (in seconds) has passed, with throttling.
description: |
Schedules a function to be executed after `delayTime` seconds have passed,
without yielding the current thread. This function allows multiple Luau
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.
parameters:
- name: delayTime
type: number
default:
summary: |
The amount of time that this function will be queued before being
executed.
- name: callback
type: function
default:
summary: |
The function that will be executed once `delayTime` seconds have
passed.
returns:
- type: ()
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
This method has been superseded by `Library.task.delay()` and should not
be used for future work.
- name: DebuggerManager
summary: |
Refers to the legacy `DebuggerManager` class which acts as an interface
for the Luau debugger feature.
description: |
Returns the legacy `DebuggerManager` class which acts as an interface for
Roblox's Luau debugger feature.
This function is not recognized by Luau's analysis tool and will raise an
undefined global warning.
parameters: []
returns:
- type: DebuggerManager
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
The `DebuggerManager` is obsolete and serves little to no use case for
developers.
- name: elapsedTime
summary: |
Returns the amount of time in seconds that the current instance of Roblox
has been running for.
description: |
Returns how much time has elapsed since the current instance of Roblox was
started. In Roblox Studio, this begins counting up from the moment Roblox
Studio starts running, not just when opening a place.
parameters: []
returns:
- type: number
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: PluginManager
summary: |
Refers to the `Class.PluginManager`, a deprecated singleton that was
previously required to create plugins.
description: |
Returns the `Class.PluginManager` which is a deprecated singleton that was
previously required to create plugins. It still has some applicable uses,
such as if you need to create a `Class.Plugin` object from Studio's
[Command Bar](../../../studio/ui-overview.md#command-bar).
parameters: []
returns:
- type: PluginManager
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: printidentity
summary: |
Prints "Current identity is X", where X corresponds to the current
thread's security context level.
description: |
Prints `Current identity is [ID]` to the output, where [ID] corresponds to
the current thread's security context level.
parameters:
- name: prefix
type: string
default: Current identity is
summary: ''
returns:
- type: ()
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: ''
- name: settings
summary: |
Returns the `Class.GlobalSettings` object, which can be used to access
settings objects that configure Roblox Studio's behavior.
description: |
Returns the `Class.GlobalSettings` object, which can be used to access the
settings objects that are used in Roblox Studio's settings menu.
parameters: []
returns:
- type: GlobalSettings
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: spawn
summary: |
Calls a function immediately through the engine scheduler, with
throttling.
description: |
Runs the specified callback function in a separate thread, without
yielding the current thread.
The function will be executed the next time Roblox's Task Scheduler runs
an update cycle. This delay will take at least 29 milliseconds but can
arbitrarily take longer, depending on the target framerate and various
throttling conditions.
The callback function is invoked with two arguments:
1. The first being the amount of time which elapsed from when spawn was
called to when the function was invoked.
2. The second being equivalent to elapsedTime() or roughly how long the
engine has been running.
```lua
spawn(print) -- 0.0079617658390703 451.55683163643
```
parameters:
- name: callback
type: function
default:
summary: |
The function that will be executed.
returns:
- type: ()
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
This method has been superseded by `Library.task.spawn()` and should not
be used for future work.
- name: stats
summary: |
Returns the Stats service.
description: |
Returns the `Class.Stats` service. It is preferred that developers use
`Class.ServiceProvider:GetService()` to retrieve it instead.
parameters: []
returns:
- type: Stats
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: ''
- name: tick
summary: |
Returns the amount of time in seconds since the Unix epoch according to
this device's time.
description: |
Returns how much time has elapsed, in seconds, since the Unix epoch, on
the current local session's computer. The Unix epoch is represented by
00:00:00 on 1 January 1970.
`tick()` isn't officially deprecated, but has a variety of issues. It can
be off by up to one second and returns inconsistent results across time
zones and operating systems. Use `Library.os.time()`,
`Library.os.clock()`, or `Global.RobloxGlobals.time()` instead. Also
consider `Datatype.DateTime.UnixTimestamp` and
`Datatype.DateTime.UnixTimestampMillis`.
parameters: []
returns:
- type: number
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: time
summary: |
Returns the amount of time in seconds that has elapsed since the current
game instance started running.
description: |
Returns the amount of time, in seconds, that has elapsed since the current
game instance started running. If the current game instance is not
running, this will be `0`.
If `Class.Workspace.AuthorityMode` is `Enum.AuthorityMode.Server`, this
value is synchronized between client and server.
parameters: []
returns:
- type: number
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: typeof
summary: |
Returns the type of the given object as a string, also supporting
Roblox-specific types (e.g. Vector3).
description: |
Returns the type of the object specified, as a string. This function is
more accurate than Luau's native `type` function, as it does not denote
Roblox-specific types as `userdata`.
parameters:
- name: object
type: Variant
default:
summary: |
The Luau type that will have its type checked.
returns:
- type: string
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: UserSettings
summary: |
Returns the UserSettings object, which is used to read information from
the current user's game menu settings.
description: |
Returns the `Class.UserSettings` object, which is used to read information
from the current user's game menu settings.
parameters: []
returns:
- type: UserSettings
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: version
summary: |
Returns the current version of Roblox as a string, which includes the
generation, version, patch and commit.
description: |
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.
- Version - The current release version of Roblox.
- Patch - The current patch number for this version of Roblox.
- Commit - The ID of the last internal commit that was accepted into this
version of the client.
parameters: []
returns:
- type: string
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: wait
summary: |
Yields the current thread until the specified amount of time in seconds
have elapsed, with throttling.
description: |
Yields the current thread until the specified amount of seconds have
elapsed.
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 `seconds` parameter is not specified, the
minimum duration will be used. This function returns:
- Actual time yielded (in seconds).
- Total time since the software was initialized (in seconds).
parameters:
- name: seconds
type: number
default: 0.03
summary: |
Specifies how long the thread should yield for.
returns:
- type: number
summary: ''
- type: number
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: |
This method has been superseded by `Library.task.wait()` and should not be
used for future work.
- name: warn
summary: |
Behaves similarly to print, except with more distinct formatting (yellow);
intended for messages which describe potential problems.
description: |
Behaves identically to Luau's print function, except the output is styled
as a warning, with yellow text and a timestamp. This function accepts any
number of arguments, and will attempt to convert them into strings which
will then be joined together with spaces between them.
parameters:
- name: params
type: Tuple
default:
summary: |
This function accepts any number of arguments, and will attempt to
convert them into strings which will then be joined together with
spaces between them.
returns:
- type: ()
summary: ''
tags: []
code_samples: []
deprecation_message: ''
- name: ypcall
summary: |
Legacy function to work around an old task scheduling limitation of
`Global.LuaGlobals.pcall()`.
description: |
Legacy function to work around an old task scheduling limitation of
`Global.LuaGlobals.pcall()`; should not be used for new work (use
`Global.LuaGlobals.pcall()` instead).
parameters:
- name: f
type: function
default:
summary: |
The function to be called in protected mode.
- name: args
type: Tuple
default:
summary: ''
returns:
- type: bool
summary: ''
- type: Variant
summary: ''
tags:
- Deprecated
code_samples: []
deprecation_message: ''