newproxy

Creates a proxy userdata.

Syntax

Signature
newproxy(Value: (boolean | userdata)?) -> userdata

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
Value(boolean | userdata)?Whether to create a metatable, or an existing proxy whose metatable should be shared.

Returns

TypeDescription
userdataNew 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)