Userdata: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Blocco added category |
>Blocco No edit summary |
||
Line 1: | Line 1: | ||
A userdata is just another way to represent data. It is very similar to a [[Metatables|metatable]]. You can create a new userdata by passing true to the newproxy function. | A userdata is just another way to represent data. It is very similar to a [[Metatables|metatable]]. You can create a new userdata by passing true to the newproxy function. | ||
<big><span style="color:#ff0000;">WARNING: newproxy is temporarily disabled due to maintenance on _G</span></big> | |||
<pre> | <pre> | ||
local NewUserData = newproxy(true) -- New userdata; Returns an empty metatable | local NewUserData = newproxy(true) -- New userdata; Returns an empty metatable |
Revision as of 18:19, 7 August 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.
WARNING: newproxy is temporarily disabled due to maintenance on _G
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