lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On May 4, 2012, at 1:20 PM, Emeka wrote:

>  list out all the functions in a library.

At it's most basic, something along these lines:

--8<--

local table = require( 'table' )

for aKey, aValue in pairs( table ) do
  if type( aValue ) == 'function' then
    print( aKey )
  end
end

-->8--

> maxn
> pack
> concat
> insert
> sort
> remove
> unpack

That said, this is far from fool proof as Lua is much more free form than most other languages. In other words, there is no obvious way to achieve universal introspection, as Lua code can express itself in multitude of ways.