How to configure LUA_PATH?

2

I have installed the IUP ( graphic toolkit ) in a given folder. When I run the following script from within this folder, it works perfectly ..

require("iuplua")
iup.Message('Minha Aplicação','Finalizada com sucesso!')

The iuplua.so file is a shortcut that points to /usr/lib/libiuplua52.so . This file exists in the installation directory and there is a copy at /usr/lib/lua/5.2/iuplua.so

The problem happens when I exit this directory and try to run the same application, I get this error message:

    lua: error loading module 'iuplua' from file './iuplua.lua':
    ./iuplua.lua:142: too many C levels (limit is 200) in main function near '"Toggle Text"'
stack traceback:
[C]: in ?
[C]: in function 'require'
./iuplua.lua:1: in main chunk
[C]: in function 'require'
./iuplua.lua:1: in main chunk
[C]: in function 'require'
./iuplua.lua:1: in main chunk
[C]: in function 'require'
./iuplua.lua:1: in main chunk
[C]: in function 'require'
...

If I check the search path inside the Lua interpreter:

> print (package.cpath)
/usr/local/lib/lua/5.2/?.so;/usr/lib/i386-linux-gnu/lua/5.2/?.so;/usr/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/loadall.so;./?.so

I'm not very experienced in GNU-Linux, but it seems to me a problem in the search path ... the so-called LUA_PATH ... is that right? Does anyone know how to solve this?

    
asked by anonymous 23.07.2014 / 16:31

1 answer

2

The problem was ridiculously simple ....

I actually created a test script called iuplua.lua . This choice of name was unfortunate, as require required an iuplua.so file. However, the moon search engine (lua_path) first encountered the moon extension:

/usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;/usr/local/lib/lua/5.2/?.lua;/usr/local/lib/lua/5.2/?/init.lua;/usr/share/lua/5.2/?.lua;/usr/share/lua/5.2/?/init.lua;./?.lua

(note the last option: " ./? moon "!)

So my test program was confused with the .so library and the program mentioned in the question did not run.

    
26.07.2014 / 06:09