lua-users home
lua-l archive

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


At the risk of displaying significant ignorance, I present the problem: require() fails to find a module (test11.lua) despite seemingly looking in the right place. The dofile() function finds the module. If I launch lua as "sudo lua" all is fine (except for my nervous state).

The platform is MacOSX 10.8, I have reinstalled Lua 5.1.5 several times, checked the paths (which are unix defaults)
	export LUA_DIR="/usr/local/lib/lua/5.1"
	export LUA_CPATH="?.so;$LUA_DIR/?.so"
	export LUA_PATH="?.lua;$LUA_DIR/?.lua"
and checked the permissions, owners and groups along the full path /usr/local/lib/lua/5.1/test11.lua. As my 5.1 installation was replacing 5.2, I previously deleted all traces of 5.2 before installing 5.1.

$$
$$ lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 > require"test11"
stdin:1: module 'test11' not found:
	no field package.preload['test11']
	no file 'test11.lua'
'       no file '/usr/local/lib/lua/5.1/test11.lua   -- but this file is there! ...
	no file 'test11.so'
'       no file '/usr/local/lib/lua/5.1/test11.so
stack traceback:
	[C]: in function 'require'
	stdin:1: in main chunk
	[C]: ?
 > dofile"/usr/local/lib/lua/5.1/test11.lua"          -- as demonstrated here.
 > ^D
$$
$$ sudo lua
Password:
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 > require"test11"	-- but as root, the file is found.
 > ^D
$$

Hope some one can help

Graham