API newproxy

__NOTOC__
Creates a zero-size "userdata" object, optionally with a sharable empty metatable.
 proxy = newproxy(withmetatable)
 = newproxy(otherproxy)
==Arguments==
:;withmetatable : - Whether or not to to create a metatable for the userdata.
:;otherproxy : - If an object previously created by newproxy is passed, the new userdata will share that proxy's metatable.
==Returns==
:;proxy : - A userdata proxy object.
==Details==
* This function is an undocumented part of the Lua 5.1 standard libraryhttp://lua-users.org/lists/lua-l/2003-01/msg00205.html.
* This function is used by the Secure Handlers framework as a way of providing handles to frames within the restricted environment.
* Objects created by this function can have a metatable with a __gc method installed to dispatch a function when the object is garbage collected.
** When using finalizers it is strongly recommended to use a protected call barrier as any errors that escape a finalizer may crash the client.
local function OnObjectCollected_Protected()
 error("Collected!")
end
local function OnObjectCollected()
 -- All errors within 'OnObjectCollected_Protected' will be forwarded
 -- to the global error handler and will avoid crashing the client.
 securecallfunction(OnObjectCollected_Protected)
end
local object = newproxy(true)
getmetatable(object).__gc = OnObjectCollected
==Patch changes==
==References==