Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does newproxy mean and what are its use cases?

Asked by 5 years ago

All I know about newproxy so far

I know newproxy is a function that takes the argument addMetatable. This function returns a userdata. I don't quite understand what this means. I know what a userdata is, but I don't quite understand how making new userdatas will have an important role in coding games. In the userdata, there is a metatable(if addMetatable is true). I am adequetly good at metatables. I have never seen an example that uses newproxy.

So, where am I stuck on?

local NewUserdata = newproxy(true)
print(NewUserdata.mt) -- Is there an mt metatable in the userdata? I am just gonna print its             
                                     --pointer

I don't understand how to access the mt.

What are some use cases?

I think the most difficult question to answer is any use cases for this.

Thank you for looking at this question.

Answer this question