Lua files as examples

Ulrike Fischer news3 at nililand.de
Fri Jul 19 12:41:08 CEST 2019


Am Fri, 19 Jul 2019 09:11:50 +0000 schrieb Urs Liska:

>> On another front:
>> 
>>> require(subfolder.module-name) from the main .lua file. 
>> 
>> Does that actually work? 
> 
> I don't really know,

Yes it does. See e.g. the graphdrawing library in
\texmf-dist\tex\generic\pgf\graphdrawing\lua\pgf\gd which uses a
similar layout. 

But I remember of a least one case where it lead to a name clash (I
think in context but I'm not sure). 

If possible at least the main lua-file should contain a declaration,
so that it shows up in the log. luaotfload e.g. has this:

local ProvidesLuaModule = {
    name          = "luaotfload-init",
    version       = "2.98",      
    date          = "2019-07-04",
    description   = "luaotfload submodule / initialization",
    license       = "GPL v2.0"
}

if luatexbase and luatexbase.provides_module then
  luatexbase.provides_module (ProvidesLuaModule)
end 



>> If you have a preference, the runtime .lua files can end up either under
>> scripts/ or under tex/. Let me know. --best, karl.
 
> I don't know much about the TDS, but it seems somewhat natural that they are under scripts/.

luaotfload-tool.lua is in scripts as it is connected/used by the
command line tool luaotfload-tool. 

The other lua-file of luaotfload are in tex/luatex as they are used
by documents. 


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the tex-live mailing list