API newproxy

From Wowpedia
Jump to: navigation, search

Creates a zero-size "userdata" object, optionally with a sharable empty metatable.

obj = newproxy(boolean or otherproxy)


Arguments

(boolean or otherproxy)
boolean 
Whether 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

obj 
Userdata (an opaque block of memory)


Details

The newproxy function is an undocumented part of the base library in Lua 5.0 and 5.1. It is included here because it is used in the implementation of the Secure Headers added in WoW 3.0 (see FrameXML\SecureHandlers.lua), and addon authors looking over that code are likely to be curious about what it does.

For more details, see http://lua-users.org/wiki/HiddenFeatures (including the links into the lua-users mailing list at the end of that section). A concise summary is here. This function was removed in Lua 5.2, but if WoW ever moves to using 5.2, we can expect that Blizzard will either backport the (very simple) implementation or recode the Secure Headers to not use it.