[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to infer the methods/functions in a library
- From: Michal Kottman <k0mpjut0r@...>
- Date: Fri, 4 May 2012 13:35:56 +0200
On 4 May 2012 13:28, Daniel Silverstone <dsilvers@digital-scurf.org> wrote:
> On Fri, May 04, 2012 at 12:20:56PM +0100, Emeka wrote:
>> There is this popular language which allows one to easily list out all the
>> functions in a library.
>> Say I have this:
>> import os
>> dir(os) Will list the functions and others.
>> How can I do the same with Lua?
>
> lua -e'table.foreach(require "os", print)'
>
> Not as pretty, but it'll work.
If you have Microlight [1], you can do this:
lua -e 'print(require"ml".tstring(require"os"))'
You can achieve similar results using methods listed in [2].
[1] https://github.com/stevedonovan/Microlight
[2] http://lua-users.org/wiki/TableSerialization