global
This is not a library! It represents any globals pushed to the thread's environment!
Properties
_RENV
Globalglobal._RENV:
{
[
any
]
:
any
}
The global roblox environment, as a table.
_GENV
Globalglobal._GENV:
{
[
any
]
:
any
}
The global executor environment, as a table.
_ENV
Globalglobal._ENV:
{
[
any
]
:
any
}
The current thread's environment, as a table.
Functions
gettenv
Globalglobal.
gettenv
(
thread:
thread
--
The thread to fetch the environment of.
) →
{
[
any
]
:
any
}
--
The environment of the thread.
Fetches the environment of a thread.
httpget
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. YieldsGlobalglobal.
httpget
(
url:
string
--
The URL to send the request to.
) →
string
--
The body of the response.
Fetches the Body of an HTTP server using a GET HTTP request.
Errors
Type | Description |
---|---|
Invalid protocol (expected 'http://' or 'https://') | The provided URL is not on the form of an HTTP request. |
messagebox
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. YieldsGlobalglobal.
messagebox
(
text:
string
,
--
The text to display in the message box.
caption:
string
,
--
The caption to display in the message box.
flags:
number
--
The flags to apply to the message box.
) →
number
--
The result of the message box.
Creates a Win32 MessageBox with the provided text, caption, and flags. Yields until the message box is closed.
Errors
Type | Description |
---|---|
Win32 error '%s' | An error occured while trying to display the messagebox. The Win32 error will be in-place of the '%s'. |
getgenv
Globalglobal.
getgenv
(
) →
{
[
any
]
:
any
}
--
The global environment of the executor.
Obtains the global environment of the executor. Contains all of rSUNC globals.
Sandboxing
All threads must be sandboxed. This means that modifications to the current thread's global environment should NOT pollute the result of getgenv
.
Modifications done to the table returned by getgenv
must be observable to all threads an executor makes, but not observable to other threads within the VM, such as game threads.
Example:
do
-- Thread 1
HelloVariable = "Hello"
print(HelloVariable) -- prints 'Hello'
print(HelloVariableViaGetGenv) -- prints 'nil'
print(getgenv().HelloVariableViaGetGenv) -- prints 'nil'
getgenv().HelloVariableViaGetGenv = HelloVariable -- Set HelloVariableViaGetGenv to the value of HelloVariable (can be observed by Thread 2!)
print(HelloVariable) -- prints 'Hello'
print(HelloVariableViaGetGenv) -- prints 'Hello'
print(getgenv().HelloVariableViaGetGenv) -- prints 'Hello'
end
-- ...
do
-- Thread 2 (runs after thread 1)
print(HelloVariable) -- prints 'nil'
print(HelloVariableViaGetGenv) -- prints 'Hello'
print(getgenv().HelloVariableViaGetGenv) -- prints 'Hello'
end
getrenv
Globalglobal.
getrenv
(
) →
{
[
any
]
:
any
}
--
The global environment of main thread of Luau.
Returns the global environment of main thread of Luau. This environment is different from the executor environment.
Sandboxing
You must NOT modify this environment under ANY circumstance. ANY modification will be observable by all threads in the VM.
getreg
Globalglobal.
getreg
(
) →
{
[
any
]
:
any
}
--
The Luau registry
Returns the Luau registry.
getscriptglobals
Globalglobal.
getscriptglobals
(
) →
{
_G:
{
[
any
]
:
any
}
,
shared:
{
[
any
]
:
any
}
}
Returns the _G
and shared
script globals.