luamod: for searching Lua Libraries!
One utility to search them all.
During my work and off-hours, I work with a lot of Lua modules, proprietary or open source. And while I was still learning the ropes, it would always find myself firing up a Lua interpreter and just looping through a module’s functions to understand what they do.
And when one has a lot of Lua modules available, it can get confusing and annoying to fire up a Lua interpreter every time. So, I solved it the easiest way I could: writing my own CLI utility!
Introducing: luamod
! The utility which, as long as the Lua module is accessible in Lua’s module search paths, it will print out all of the module’s contents!
With it, instead of doing this(and yes, I still use Lua 5.1):
-- #$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int64)
> a = require "string"
> for k,v in pairs(a) do print(k,v) end
sub function: 0x5602557bf000
upper function: 0x5602557bf060
len function: 0x5602557bee20
gfind function: 0x5602557bed60
rep function: 0x5602557bef40
find function: 0x5602557bec40
match function: 0x5602557beee0
char function: 0x5602557beb80
dump function: 0x5602557bebe0
gmatch function: 0x5602557bed60
reverse function: 0x5602557befa0
byte function: 0x5602557beb20
format function: 0x5602557beca0
gsub function: 0x5602557bedc0
lower function: 0x5602557bee80
You can just do this!
-- #$ luamod string
sub function: 0x5580dab50000
upper function: 0x5580dab50060
len function: 0x5580dab4fe20
gfind function: 0x5580dab4fd60
rep function: 0x5580dab4ff40
find function: 0x5580dab4fc40
match function: 0x5580dab4fee0
char function: 0x5580dab4fb80
dump function: 0x5580dab4fbe0
gmatch function: 0x5580dab4fd60
reverse function: 0x5580dab4ffa0
byte function: 0x5580dab4fb20
format function: 0x5580dab4fca0
gsub function: 0x5580dab4fdc0
lower function: 0x5580dab4fe80
This utility is available on my Gists here along with some basic instructions on how I have it set up.