noobyy
noobyy

Reputation: 143

Is it possible to dump the properties/methods of a type userdata variable?

Hi I'm wanting to get all the properties and methods of a type function that returns userdata. The documentation on the API i'm using is quite poor, and I know there are more stuff not documented.

local w = gui.CreateWindow(...) -- "returns userdata"

I would like to loop over w and get all it's functions and properties

Thanks

Upvotes: 2

Views: 1524

Answers (1)

Paul Kulchenko
Paul Kulchenko

Reputation: 26794

There is no general mechanism to do this. If the userdata instance you get back has a metatable, you can retrieve it and browse/navigate, as you'd do for a regular table.

If it's ffi-based userdata, you can get some additional information using ffi.typeinfo (see ffi-reflect and parseback for modules that use that).

Upvotes: 0

Related Questions