Getting API info from C to Lua?

how can I get a list of all C API functions with Lua? For example, there are plenty C functions in a game(Crysis) which can be called with


There are many functions I know but how can I get all available functions?


If is a table, traverse it looking for functions. If it is a userdata, look inside its metatable. (Also if it is a table.)

There may or may not be an easy way to enumerate all of the C functions.

The may actually contain the functions, but this would be unusual. Something like the following will list these functions.

for k,v in pairs( do if print(k,v) end

More likely will have a meta-table with an __index entry that is either a table or a a function. If the __index entry is a table the following will list all the functions.

for k,v in pairs(getmetatable( do print(k,v) end

This will only determine the names of the functions, the parameter list will still be an unknown.

If however, the __index value for the meta-table is a function, then there will be no easy way to list the functions.

for i,v in pairs(getmetatable(g_gameRules).__index) do 
    System.LogAlways(i.." : "..v); 


    for i,v in pairs(g_gameRules) do 
    System.LogAlways(i.." : "..v); 

Need Your Help

How to add 'Notification', 'Warning' and 'Error' icons on Prism 6.2 WPF modal dialog?

c# wpf mvvm modal-dialog prism

In my Prism 6.2 WPF MVVM application I use notification and confirmation modal dialogs. Below is a definition of the View of a notification modal dialog used in my application: