Hi List,

I wrote a module that draws globes, but I’ve run into a problem as I get it 
ready to share. The module works fine for documents that are in the same folder 
as the module’s various files, but it doesn’t work for documents that are 
anywhere else. ConTeXt finds and loads the module, but it can’t find the data 
files containing the map data.

The module’s files and directory structure can all be found at:

https://github.com/Sophias-Compass/luageo

It is organized according to the TDS instructions for modules on the wiki.

Here’s what is going wrong, in more detail.

I put my pre-release luageo module into texmf-local so that I could use it in 
other documents. This works if the other document is in the luageo directory 
with the module, but it doesn’t work if the other document is anywhere else. 
The module still loads. (From a failed log file…)

        modules         > 'luageo' is loaded
        open source     > level 2, order 3, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-local/luageo/tex/context/third/luageo/t-luageo.mkxl’

But the module can’t find the map data files.

        lua error       > lua error on line 41 in file 
/Users/Gavin/context-osx-arm64/tex/texmf-local/luageo/tex/context/third/luageo/t-luageo.mkxl:
        token call, execute: cannot open data/iles.lua: No such file or 
directory

The main module file, t-luageo.mkxl, contains a line to load t-luageo.lmt, 
which has the necessary Lua code.

        \registerctxluafile{t-luageo}{}

The Lua code states that the map data should be found in the data directory.

        moduledata     = moduledata or { }
        local geo      = { }
        moduledata.geo = geo
        geo.datafolder = "data/“

I’m not actually sure what all those lines do. (I think they were written by 
Hans when he was helping me earlier.) Later, the Lua code loads the data.

        dofile("data/iles.lua")
        dofile("data/ameriquenord.lua”)
        …

This works if the document using the module in in the module folder, but it 
breaks if the document is somewhere else.

Any suggestions? The full failed log file is below.

Thanks!
Gavin


resolvers       | formats | executing runner 'run luametatex format': 
/Users/Gavin/context-osx-arm64/tex/texmf-osx-arm64/bin/luametatex 
--jobname="./luageo-manual.tex" --socket --shell-escape 
--fmt=/Users/Gavin/context-osx-arm64/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
 
--lua=/Users/Gavin/context-osx-arm64/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
  --c:currentrun=1 --c:fulljobname="./luageo-manual.tex" 
--c:input="./luageo-manual.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex 
--c:texmfbinpath="/Users/Gavin/context-osx-arm64/tex/texmf-osx-arm64/bin"
system          > 
system          > ConTeXt  ver: 2025.08.20 10:30 LMTX  fmt: 2025.8.22  int: 
english/english
system          > 
system          > 'cont-new.mkxl' loaded
open source     > level 1, order 1, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system          > beware: some patches loaded from cont-new.mkiv
close source    > level 1, order 1, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system          > files > jobname './luageo-manual', input 
'./luageo-manual.tex', result './luageo-manual'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
system          > synctex functionality is enabled, expect 5-10 pct runtime 
overhead!
open source     > level 1, order 2, name './luageo-manual.tex'
modules         > 'luageo' is loaded
open source     > level 2, order 3, name 
'/Users/Gavin/context-osx-arm64/tex/texmf-local/luageo/tex/context/third/luageo/t-luageo.mkxl'
lua error       > lua error on line 41 in file 
/Users/Gavin/context-osx-arm64/tex/texmf-local/luageo/tex/context/third/luageo/t-luageo.mkxl:

token call, execute: cannot open data/iles.lua: No such file or directory
stack traceback:
[C]: in global 'dofile'
...texmf-local/luageo/tex/context/third/luageo/t-luageo.lmt:108: in local 'code'
...m64/tex/texmf-context/tex/context/base/mkiv/util-lua.lua:97: in field 
'loadedluacode'
...m64/tex/texmf-context/tex/context/base/mkiv/luat-env.lua:108: in field 
'luafilechunk'
...m64/tex/texmf-context/tex/context/base/mkxl/luat-cod.lmt:82: in field 
'registercode'
[ctxlua]:1: in main chunk
31     %  [luageo]
32     %  [\s!format=metafun,
33     %   \s!extensions=\v!yes,
34     %   \s!initializations=\v!yes,
35     %   \c!method=\s!double]
36     
37     \startMPdefinitions
38         loadmodule "luageo" ;
39     \stopMPdefinitions
40     
41 >>  \registerctxluafile{t-luageo}{}
42     
43     %  % Module's ConTeXt code from here to \protect. Example of a namespace 
and a module parameter
44     
45     %  \installnamespace {luageo}
46     %  \installcommandhandler       \????luageo      {luageo}      
\????luageo
47     
48     %  \setupmodule[color=newman]
49     %  \processaction[\currentmoduleparameter{color}]
50     %    [    newman=>\def\BColor{red},
51     %       gottlieb=>\def\BColor{yellow},
mtx-context     | fatal error: return code: 1
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to