newproxy
Creates a proxy userdata.
Syntax
Signature
newproxy(Value: (boolean | userdata)?) -> userdataAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Value | (boolean | userdata)? | Whether to create a metatable, or an existing proxy whose metatable should be shared. |
Returns
| Type | Description |
|---|---|
userdata | New proxy userdata. |
Notes
false or nil creates one without a metatable, true creates one with a new metatable, and another owned proxy reuses that proxy's metatable. The existing runtime implementation is kept when one is available.
Example
Luau
local Proxy = newproxy(true)
getmetatable(Proxy).__tostring = function() return "Example proxy" end
print(Proxy)