[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to infer the methods/functions in a library
- From: Petite Abeille <petite.abeille@...>
- Date: Fri, 4 May 2012 13:33:40 +0200
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.