Userdata: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Mattchewy New page: A userdata is just another way to represent data. It is very similar to a metatable. You can create a new userdata by passing true to the newproxy function. <pre> local N... |
>Blocco added category |
||
Line 11: | Line 11: | ||
userdata Foo EPIC | userdata Foo EPIC | ||
</pre> | </pre> | ||
[[Category:Data Types]] |
Revision as of 23:31, 29 June 2010
A userdata is just another way to represent data. It is very similar to a metatable. You can create a new userdata by passing true to the newproxy function.
local NewUserData = newproxy(true) -- New userdata; Returns an empty metatable getmetatable(NewUserData).__index = {Name = "Foo", FooValue = "EPIC"} -- index MetaMethod print(type(NewUserData), NewUserData.Name, NewUserData.FooValue)
In the output window, you should see
userdata Foo EPIC