On 04/13/2013 10:03 AM, Élie Roux wrote:
Dear all,

I'm currently updating luatexbase, and I have a few questions:

The first two are related to the behaviour when searching for
"module.submodule" as "module/submodule.lua":

  - Am I right if I say that package.searchers[2] looks weel for it but
    kpse.find_file("module.submodule", 'lua') doesn't?

Yes. But package.searchers[2] is quite trivial. In lua code, it would
look like this:

function search (name)
   altname = string.gsub(file,'.','/')
   filename = kpse.find_file(altname, 'lua')    
   if not filename then
     filename = kpse.find_file(name, 'lua')
   end
   if not filename then
     return string.format("[kpse lua searcher] file not found: %s", name)
   else
     return loadfile(filename)
   end
end


  - If it's true, is there a way to make it work with kpse.find_file?

Just write a thin wrapper to replace '.' with '/', as above.

The goal of not just letting packages.searchers[2] do his job quietly
(which it does well), is just to print the name of the loaded file,
between brackets... So the third question is:
   - is it possible to make the kpse version of packages.searchers[2]
     return a string containing the file name?

That is not possible. It has to return either an error string, or a
loader function (the result of loadfile()).

Best wishes,
Taco

_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to