lua-users home
lua-l archive

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


I was about to file a bug report (the file name gives that away)
but caught on just in time.

…/tmp$ cat case1.lua
path = "/home/dirk/test/EXT/?.EXT;./?.EXT"
name = 'lua53'
ext = 'bug'
version, msg = package.searchpath (name, path:gsub("EXT",ext))
print(version,msg)

Fails!

…/tmp$ lua case1.lua
nil
    no file '/home/dirk/test/bug/lua5/.bug'
    no file './lua5/.bug'

But ...

…/tmp$ cat case2.lua
path = "/home/dirk/test/EXT/?.EXT;./?.EXT"
name = 'lua53'
ext = 'bug'
path = path:gsub("EXT",ext)
version, msg = package.searchpath (name, path)
print(version,msg)

Works!

…/tmp$ lua case2.lua
/home/dirk/test/bug/lua53.bug    nil

Check: change path:gsub(...) to (path:gsub(...)) in case1, it works.