Sunday, August 8, 2010

lua readline tab completion

#!/bin/bash

LUA_HOME="$HOME/opt/lua"
LUA_PATH="$LUA_PATH;$LUA_HOME/?.lua" LUA_CPATH="$LUA_CPATH;$LUA_HOME/?.so" "$LUA_HOME/bin/lua" -lreadline -lcomplete $*

where readline and complete are from  http://lua-users.org/wiki/CompleteWithReadline

use readline.c and complete.lua. You don't have to patch lua.c.

read http://www.lua.org/manual/5.1/manual.html#pdf-package.loaders to know how to use LUA_PATH and LUA_CPATH. question mark (?) in LUA_PATH or LUA_CPATH is replaced with foo when you do require("foo"). And, when you do require("foo.bar"),  it searches for foo/bar.lua or foo/bar.so if LUA_(C)PATH.

No comments:

Post a Comment