lua-users home
lua-l archive

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



It was thus said that the Great  Sean Conner once stated:


  That's because *WINDOWS* makes the EXE path available to the application.
Unix *DOES NOT*.  Take the following C program:

It seems Lua make absolute path available unless I misunderstood your post:

code:
#!/usr/bin/env lua
print('Path:',arg[0], '  ---  DebugPath:',debug.getinfo(1).short_src)
B = require'scripts.b'
B.talk("Whatever you say")

Path: /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/arch/mygit/lua-t/example/


Output (this does NOT have the patch applied so it fails, but the path would be available):
[arch@tk-box lua-t]$ a.lua
Path: /home/arch/mygit/lua-t/example/a.lua --- DebugPath: /home/arch/mygit/lua-t/example/a.lua
lua: /home/arch/mygit/lua-t/example/a.lua:3: module 'scripts.b' not found:
        no field package.preload['scripts.b']
        no file '/usr/share/lua/5.3/scripts/b.lua'
        no file '/usr/share/lua/5.3/scripts/b/init.lua'
        no file '/usr/lib/lua/5.3/scripts/b.lua'
        no file '/usr/lib/lua/5.3/scripts/b/init.lua'
        no file './scripts/b.lua'
        no file './scripts/b/init.lua'
        no file '/usr/lib/lua/5.3/scripts/b.so'
        no file '/usr/lib/lua/5.3/loadall.so'
        no file './scripts/b.so'
        no file '/usr/lib/lua/5.3/scripts.so'
        no file '/usr/lib/lua/5.3/loadall.so'
        no file './scripts.so'
stack traceback:
        [C]: in function 'require'
        /home/arch/mygit/lua-t/example/a.lua:3: in main chunk
        [C]: in ?

 -Tobias