FANDOM


UserdataEdit

EssentialsEdit

The userdata type is created only by the newproxy function. It is used to represent an object. Data is only able to be stored in its metatable.

SamplesEdit

Sample
The following is a sample of using a userdata.

Source:

local foo = newproxy(true)
getmetatable(foo)['__index'] = function(_, b)
       return ({Hello = 'World', Foo = 'Bar'})[b]
end
print(foo['Hello'])
Output:

World