I was messing around with Lua yesterday and stumbled upon the 'newproxy' function.
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#newproxy
I kind of understand it, but I'm not sure how it is useful. I know it creates a blank userdata object with a metatable attached (if the argument is true).
How it newproxy useful? Here is an example of what I did while messing around with it:
local proxy = newproxy(true) local metatable = getmetatable(proxy) metatable.__index = function(array, key) print(array, key) end local y = proxy[100] --[[ OUTPUT: userdata: 0x443ad4b4 100 ]]
Proxies in this regard appear to just be empty Tables with another empty Table set as its metatable, assigned as a 'userdata' (I.e. a C-level data construct) instead of a Table.
I'm using this as reference, since as that page says, newproxy
is undocumented.
EDIT: Basically, turning a Table into an Object, sorta.