luanoob luanoob - 1 year ago 121
C++ Question

Lua - Reflection - Get list of functions/fields on an object?

I'm new to Lua and dealing with Lua as a scripting language in an alpha release of a program. The developer is unresponsive and I need to get a list of functions provided by some C++ objects which are accessible from the Lua code.

Is there any easy way to see what fields and functions these objects expose?

Answer Source

In Lua, to view the members of a object, you can use:

for key,value in pairs(o) do
    print("found member " .. key);
end

Unfortunately I don't know if this will work for objects imported from C++.