Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm not very good at manual installation. I want to use lcurses, a binding of curses for Lua in a program, with require('curses'). When I run make in the lcurses directory, there is an error complaining about the path LUA, defined in the Makefile, not existing.

I think I need to figure out where the correct Lua directory is, but I don't know where it might be. I've searched with Nautilus and its searching thingy, but I couldn't find a directory named "Lua" that had include, lib, and bin subdirectories, all of which seem to be wanted in the Makefile.

I'm not sure that the directory is the only issue, though. How do I set it up? I'm on Ubuntu 11.10, if that helps, and I've never managed to get a Lua require thingy to work.

And this is what the beginning of the Makefile looks like:

# makefile for lcurses library for Lua

# dist location

# change these to reflect your Lua installation
LUAINC= $(LUA)/include
LUALIB= $(LUA)/lib
LUABIN= $(LUA)/bin
share|improve this question

Most distributions install Lua next to all other programs in /usr, not to a directory of its own; LUA = /usr seems to be the correct path here, at least on Arch.

If it is not, search for files include/lua.h or lib/liblua.a, after installing the proper -dev packages if necessary.

find / -name lua.h
share|improve this answer
Using "find / -name lua.h" brought up a directory of "/usr/include/lua5.1/lua.h". LUA = /usr did not work, I got a "No such file or directory" error, again. – Uronym Feb 13 '12 at 0:24
@Uronym: From that result, it seems that you have to redefine the variables directly: LUA = /usr, LUAINC = /usr/include/lua5.1. For LUALIB, use the same command to find liblua.a, I am guessing LUALIB = /usr/lib/lua5.1 though. – grawity Feb 13 '12 at 0:26
LUA=/usr LUAINC= /usr/include/5.1 LUALIB= /usr/lib/lua5.1 LUABIN= /usr/bin/lua5.1 did not work, same error. Is that what you meant? – Uronym Feb 13 '12 at 18:32
@Uronym: No; LUA=/usr LUAINC=/usr/include/lua5.1 LUALIB=/usr/lib/lua5.1 LUABIN=/usr/bin. – grawity Feb 15 '12 at 11:29

If you install the Lua .deb package, you should have no problem. The following script should tell you where Lua is looking for modules of both the Lua and compiled C varieties:

strPaths = package.path .. "\r?\n"
strPaths = strPaths .. package.cpath 
strPaths = string.gsub(strPaths, ";", "\r?\n")
print strPaths

You can also set a custom path using an environmental variable. See the Lua Reference manual documentation for package.path and package.cpath.

Finally, a script can set its own path to a module. See

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .