lua-users home
lua-l archive

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

I'm putting on my Lua Newbie hat for this one. It's an old hat,
and does not fit very well anymore, but sometimes it is still
the most appropriate hat to wear.

Suppose I wish to write a little on-off application that uses some
battery not included in the standard library. Say I wish to make
a window appear somewhere on my screen, display some text,
get a response from a user (maybe an edited version of that text)
and after the user gives an "exit" response. eventually disappear

An everyday task, more or less Example 2 in a Tcl/Tk tutorial
after Hello, World.

Now obviously it is possible in Lua. Everything is. I just have to install
the right rock, briefly read the very user-friendly documentation, and
I'll be up and running in fifteen minutes. Easy-peasy lemon squeezy.

OK. LuaRocks search, here I come. Wait a minute, I'm not quite
sure what search options it has, let's just quickly ask help on that.

$ luarocks help search

LuaRocks 2.2.1, a module deployment system for Lua

    /usr/local/lib/luarocks/rocks/luarocks/2.2.1-2/bin/luarocks search
- Query the LuaRocks servers.

    /usr/local/lib/luarocks/rocks/luarocks/2.2.1-2/bin/luarocks search
[--source] [--binary] { <name> [<version>] | --all }

    --source  Return only rockspecs and source rocks,
              to be used with the "build" command.
    --binary  Return only pure Lua and binary rocks (rocks that can be used
              with the "install" command without requiring a C toolchain).
    --all     List all contents of the server that are suitable to
              this platform, do not filter by name.

It tells me exactly where on my system Luarocks is installed. Twice. Thanks.

But I need to know the name of the module, it seems. Wait a bit, I seem to
remmeber just part of the name is also OK. If I can just guess what the
module contributor called the module, I'll be OK.

Let's try a keyword. Window?

$ luarocks search window

Search results:

Rockspecs and source rocks:

   0.5-2 (rockspec) -
   0.5-2 (src) -

   0.1-2 (rockspec) -
   0.1-2 (src) -

Interesting. I'd like to know more about them before deciding which,
if either to install. Taking off my newbie hat in order to prove that the
information I want is not hard to provide: it's the contents of the
'detailed' field in the rockspec.

Anyway, I'll spare you the details of how I, the newbie, figured out
how to download a rockspec, how it became obvious that "windows"
means the program is specific to an operating system that I don't use,
and how an unwanted thought that I prefer to suppress entered my head,

       Wasn't it much easier in Python?

My Python hat is even older than my Lua Newbie hat, but still good
enough for this purpose. Open, click Documentation,
click Library Reference, glance down the nicely classified list, find

16. Generic Operating System Services
    16.10. curses — Terminal handling for character-cell displays

Now back to LuaRocks, armed with the magic word.

$ luarocks search curses

Search results:

Rockspecs and source rocks:

   9.0.0-1 (rockspec) -
   9.0.0-1 (src) -
   6-2 (rockspec) -
   6-2 (src) -

OK, I can take it from there: briefly read the very user-friendly
documentation, and I'll be up and running in fifteen minutes. EPLS.

But isn't it ironical that I needed to go to the Python site to get the
name of the needed module?

So, to get back to the subject: some roadmap through LuaRocks,
just a classified list of currently available rocks with a six-word
phrase describing each (and please, if the rock's name is "lxyzzy",
not just "A binding to the xyzzy library"), is that too much ask from
a newbie like me? Accessible as e.g. "luarocks help --roadmap"?