lua-users home
lua-l archive

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


I'm releasing LuaHelp, a simple manual page system for the Lua interpreter.
LuaHelp is under public domain and contains lhp (Lua Help Pages) -- I was
thinking about Lua Help Files, but the acronym was already taken ;) -- for all
functions (and constants) in the core Lua libs. It can be found at

I'm attaching a rock spec for it, but should expect this rock to hit the
repositories soon.

Of course, any comments/suggestions/bug reports/patches are welcome. Enjoy!

$ lua -lhelp
Lua 5.1.4  Copyright (C) 1994-2008, PUC-Rio
> help()

help (fname)

  Prints the help available for function `fname`. The help description is
  available either from a previous `help.register` command or by reading a Lua
  help page (LHP) file `fname.lhp` stored at some template path in
  `help.path`, similarly to how modules are searched using `package.path`
  (check `help("package.path")`). In either case the help description is

  __See also__: `help.register`.

> help"package.path"


  The path used by `require` to search for a Lua loader.

  At start-up, Lua initializes this variable with the value of the environment
  variable LUA_PATH or with a default path defined in luaconf.h, if the
  environment variable is not defined. Any ";;" in the value of the
  environment variable is replaced by the default path.

  A path is a sequence of _templates_ separated by semicolons. For each
  template, `require` will change each interrogation mark in the template by
  `filename`, which is `modname` with each dot replaced by a "directory
  separator" (such as "/" in Unix); then it will try to load the resulting
  file name. So, for instance, if the Lua path is


  the search for a Lua loader for module foo will try to load the files
  `./foo.lua`, `./`, and `/usr/local/foo/init.lua`, in that order.

> help"help.register"

help.register (fname, desc)

  Registers help description `desc` for function named `fname`, so that
  `help(fname)` prints `desc`. Both arguments should be strings.


Computers are useless. They can only give you answers.
                -- Pablo Picasso

Luis Carvalho (Kozure)
lua -e 'print(((""):gsub("(%u+%.)","")))'
package = "LuaHelp"
version = "0.1-1"

source = {
  url = "";,
  md5 = "3f67687cf91f6535aeeebab0f7915b2e"

description = {
  summary  = "Help pages for Lua",
  detailed = [[
    LuaHelp provides a simple interface to manual pages, called Lua Help Pages
    (LHP). From the interpreter, just call "help()" for a more detailed
  homepage = "";,
  license = "Public domain"

dependencies = {
  "lua >= 5.1"

local basefiles = {

local libfiles = {
  -- coroutine
  -- debug
  -- help
  -- io
  -- math
  -- os
  -- package
  -- string
  -- table

local lhp = {}
for i = 1, #basefiles do
  local f = basefiles[i]
  local t = {f:match("^(lhp)/([%w_]+)%.lhp$")}
  lhp[t[1] .. "." .. t[2]] = f
for i = 1, #libfiles do
  local f = libfiles[i]
  local t = {f:match("^(lhp)/(%w+)/([%w_]+)%.lhp$")}
  lhp[t[1] .. "." .. t[2] .. "." .. t[3]] = f

build = {
  type = "builtin",
  modules = {
    help = "help.c"
  install = { lua = lhp }