Lua in Ctx: "require()" fails?
Hello, I just renewed ConTeXt and new error when using "require" appears (it worked OK until the update): ---- t-Req.mkiv \startluacode require "Test-U" \stopluacode \starttext A \stoptext ---- " mtx-context | run 1: luatex --fmt="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en" --interaction="nonstopmode" --jobname="t-Req" --lua="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en.lui" --no-parse-first-line --c:FILE="t-Req.mkiv" --c:currentrun=1 --c:fulljobname="C:/Lukas/ConTeXt/Test/t-Req.mkiv" --c:halt-on-error --c:input="C:/Lukas/ConTeXt/Test/t-Req.mkiv" --c:kindofrun=1 --c:mode="t-Req" --c:nonstopm ode "cont-yes.mkiv" This is LuaTeX, Version beta-0.70.2-2012092822 (TeX Live 2012/W32TeX) \write18 enabled. (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2012.10.02 22:03 MKIV fmt: 2012.10.4 int: english/english system > cont-new.mkiv loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv system > beware: some patches loaded from cont-new.mkiv ) fonts > latin modern fonts are not preloaded languages > language en is active (C:/Lukas/ConTeXt/Test/t-Req.mkiv ! LuaTeX error <main ctx instance>:2: module 'Test-U' not found: no field package.preload['Test-U'] no file 'Test-U.dll' no file 'c:\Program Files\Lua\5.1\clibs\Test-U.dll' no file 'C:\Lukas\Lua\Test-U.dll' stack traceback: [C]: in function 'require' <main ctx instance>:2: in main chunk. system > tex > error on line 3 in file C:/Lukas/ConTeXt/Test/t-Req.mkiv: LuaTeX error ... 1 \startluacode 2 require "Test-U" 3 >> \stopluacode 4 5 \starttext 6 A 7 \stoptext 8 } require "Test-U".erocount { \luat_start_lua_code_indeed ...ua \zerocount {#1}} l.3 \stopluacode ... " ---- Test-U.lua print("This is Test-U.") ---- The "Test-U.lua is located at: c:\Lukas\Lua\Test-U.lua And (some) environment variables are: " C:\Lukas\ConTeXt\Test>set lua LUA_CPATH=?.dll;c:\Program Files\Lua\5.1\clibs\?.dll;C:\Lukas\Lua\?.dll LUA_DEV=C:\Program Files\Lua\5.1 LUA_PATH=?.lua;C:\Program Files\Lua\5.1\lua\?.luac;C:\Lukas\Lua\?.lua;C:\Lukas\Common\Statics\?.lua;C:\Lukas\Lua\3rdParty\?.lua;C:\Lukas\Lua\3rdParty\stdlib\modules\?.lua " - So the "Test-U.lua" should be found. So what's wrong? What's been renewed in this matter? How to "require" a Lua file (module) correctly? Personally - I've been using "require <file-name>" so far at many places and there was no problem with it. TIA. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 4-10-2012 12:09, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Personally - I've been using "require <file-name>" so far at many places and there was no problem with it.
try with \enabletrackers[resolvers.libraries] ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 4-10-2012 13:27, Hans Hagen wrote:
On 4-10-2012 12:09, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Personally - I've been using "require <file-name>" so far at many places and there was no problem with it.
try with
\enabletrackers[resolvers.libraries]
btw, you should adapt LUAINPUTS and not some other environment variable .. after all, luatex is not native lua so you need to avoid conflicts in case you hav einstalled both ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Thu, 04 Oct 2012 13:32:42 +0200, Hans Hagen
btw, you should adapt LUAINPUTS and not some other environment variable .. after all, luatex is not native lua so you need to avoid conflicts in case you hav einstalled both
... I just added SET LUAINPUTS=%LUA_PATH% to the batch I'm using to launch context.exe and it works. Thanks for the answers. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On Fri, Oct 5, 2012 at 8:13 AM, Procházka Lukáš Ing. - Pontex s. r. o. < LPr@pontex.cz> wrote:
On Thu, 04 Oct 2012 13:32:42 +0200, Hans Hagen
wrote: btw, you should adapt LUAINPUTS and not some other environment variable
.. after all, luatex is not native lua so you need to avoid conflicts in case you hav einstalled both
... I just added
SET LUAINPUTS=%LUA_PATH%
to the batch I'm using to launch context.exe and it works.
Thanks for the answers.
Best regards,
Lukas
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4
Tel: +420 244 062 238 Fax: +420 244 461 038
______________________________**______________________________** _______________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/** listinfo/ntg-context http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/**projects/contextrev/http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________**______________________________** _______________________
For a fine and local tuning you also have the package.path and package.cpath \starttext package.path=\ctxlua{context(package.path)}\par package.cpath=\ctxlua{context(package.cpath)} \stoptext See http://www.lua.org/manual/5.1/manual.html (usually I prefer to make local changes on paths, they are more portable across minimals) -- luigi
On 5-10-2012 08:13, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
On Thu, 04 Oct 2012 13:32:42 +0200, Hans Hagen
wrote: btw, you should adapt LUAINPUTS and not some other environment variable .. after all, luatex is not native lua so you need to avoid conflicts in case you hav einstalled both
.... I just added
SET LUAINPUTS=%LUA_PATH%
to the batch I'm using to launch context.exe and it works.
You can best set that in a local texmfcnf.lua file. In that case you use the original definition of luainputs and append lua_path to it. That way script in the context tree can also be found. Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Fri, 05 Oct 2012 10:57:15 +0200, Hans Hagen
On 5-10-2012 08:13, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
On Thu, 04 Oct 2012 13:32:42 +0200, Hans Hagen
wrote: btw, you should adapt LUAINPUTS and not some other environment variable .. after all, luatex is not native lua so you need to avoid conflicts in case you hav einstalled both
.... I just added
SET LUAINPUTS=%LUA_PATH%
to the batch I'm using to launch context.exe and it works.
You can best set that in a local texmfcnf.lua file.
OK... I'm not familiar with (Lua)TeX deeply enough to know how exactly to do it, so a couple a questions: - Where to put (my personal) texmfcnf.lua? The intention is Ctx to find and load its original texmfcnf.lua and then to load my texmfcnf.lua which would modify only some elements (namely: the LUAINPUTS member). I'd like to keep "factory" texmfcnf.lua settings as much as possible. - When I look into "c:\ConTeXt\tex\texmf\web2c\texmfcnf.lua", I see many paths: - beginning with "!!", - ending with "//". What does mean this convention? - I found 2 config files: c:\ConTeXt\tex\texmf\web2c\texmf.cnf c:\ConTeXt\tex\texmf\web2c\texmfcnf.lua It seems that the latter is a "Luaed" form of the former. How are used both files? Is the latter built from the former or vice versa? Or the former is no more used and I'm having it among Ctx files by chance? (Or a link to a place where to learn more would be appreciated.) TIA. Best regards, Lukas
In that case you use the original definition of luainputs and append lua_path to it. That way script in the context tree can also be found.
Hans
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 8-10-2012 15:57, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
The intention is Ctx to find and load its original texmfcnf.lua and then to load my texmfcnf.lua which would modify only some elements (namely: the LUAINPUTS member).
texmf-local\web2c
I'd like to keep "factory" texmfcnf.lua settings as much as possible.
- When I look into "c:\ConTeXt\tex\texmf\web2c\texmfcnf.lua", I see many paths:
- beginning with "!!", - ending with "//".
What does mean this convention?
this controls the filedatabase building and recurssion into subtrees
- I found 2 config files:
c:\ConTeXt\tex\texmf\web2c\texmf.cnf c:\ConTeXt\tex\texmf\web2c\texmfcnf.lua
It seems that the latter is a "Luaed" form of the former.
a bit more than that as we can have directives and such (and even have path tables)
How are used both files?
only the lua file is used
Is the latter built from the former or vice versa?
no, for texlive the latter is adapted a bit (few lines) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello,
my "trick" with LUAINPUTS system variable stopped working after the today's Ctx update.
So I'm trying again to solve the problem that
----
\startluacode
require "LPr-U"
\stopluacode
----
doesn't load the file at "d:/Lukas/Lua/LPr-U.lua".
On Mon, 15 Oct 2012 20:29:53 +0200, Hans Hagen
On 8-10-2012 15:57, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
The intention is Ctx to find and load its original texmfcnf.lua and then to load my texmfcnf.lua which would modify only some elements (namely: the LUAINPUTS member).
texmf-local\web2c
I'd like to keep "factory" texmfcnf.lua settings as much as possible.
Hans
Following Hans' advice, I created "d:/texmf-local/web2c/contextcnf.lua" with the following content: ---- return { LUAINPUTS = "d:/Lukas/Lua/", } ---- but I'm still getting error with "require". What other steps do I have to do to make it work? TIA. Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 23-10-2012 16:14, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
my "trick" with LUAINPUTS system variable stopped working after the today's Ctx update.
afaik nothing changed; best run with \enabletrackers[resolvers.libraries] Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, 23 Oct 2012 16:13:31 +0200, Hans Hagen
On 23-10-2012 16:14, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
my "trick" with LUAINPUTS system variable stopped working after the today's Ctx update.
afaik nothing changed; best run with \enabletrackers[resolvers.libraries]
Hans
I attached the log (and all files). Here's the output (trying to require "Test.lua" now, which is in "d:\Lukas\Lua\Test.lua"): " C:\Lukas\Jobs\HubI-ISK.DSP\SO_210\Statics.Tx>t.mkiv C:\Lukas\Jobs\HubI-ISK.DSP\SO_210\Statics.Tx>set PATH=c:\ConTeXt\tex\texmf-mswin\bin;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Autodesk Shared\;C:\PROGRA~1\COMMON~1\AUTODE~1\GIS\IMPORT~1\1.0;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Lua\5.1;C:\Program Files\Lua\5.1\clibs;C:\Lukas\..\Programs.Con\Ponton;C:\Program Files\Pandoc\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Tes seract-OCR;C:\Lukas/Bat;C:\Lukas/../Programs.Con;;C:\PROGRA~1\COMMON~1\AUTODE~1 C:\Lukas\Jobs\HubI-ISK.DSP\SO_210\Statics.Tx>set LUAINPUTS=;d:/Lukas/Lua/?.lua mtx-context | run 1: luatex --fmt="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en" --interaction="nonstopmode" --jobname="t" --lua="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en.lui" --no-parse-first-line --c:FILE="t.mkiv" --c:currentrun=1 --c:fulljobname="C:/Lukas/Jobs/HubI-ISK.DSP/SO_210/Statics.Tx/t.mkiv" --c:halt-on-error --c:input="C:/Lukas/Jobs/HubI-ISK.DSP/SO_210/Statics.Tx/t.mkiv" --c:kindofrun=1 --c:mode="t" --c:nonstopmode "cont-yes.mkiv" This is LuaTeX, Version beta-0.70.2-2012101522 (TeX Live 2012/W32TeX) \write18 enabled. (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2012.10.22 23:51 MKIV fmt: 2012.10.23 int: english/english system > cont-new.mkiv loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv system > beware: some patches loaded from cont-new.mkiv ) system > files > jobname: t, input: C:/Lukas/Jobs/HubI-ISK.DSP/SO_210/Statics.Tx/t.mkiv, result: t fonts > latin modern fonts are not preloaded languages > language en is active (C:/Lukas/Jobs/HubI-ISK.DSP/SO_210/Statics.Tx/t.mkiv resolvers > libraries > ! locating "Test" as "Test.lua" using formats "texlua" resolvers > libraries > ! checking for "Test.lua"' using format "tex" resolvers > libraries > ! checking for "Test.lua"' using format "lua" resolvers > libraries > ! locating "Test" as "Test.dll" using formats "lib" resolvers > libraries > ! checking for "Test.dll"' using format "lib" resolvers > libraries > ! locating "Test" as "Test.lua" on "lua" paths resolvers > libraries > ! checking for "Test.lua" using "lua" path "." resolvers > libraries > ! checking for "Test.lua" using "lua" path "C:/Documents and Settings/LPR/texmf/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-project/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-fonts/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-local/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-modules/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-context/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf/tex/context/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "C:/Documents and Settings/LPR/texmf/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-project/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-fonts/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-local/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-modules/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-context/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf/tex/plain/base/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "C:/Documents and Settings/LPR/texmf/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-project/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-fonts/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-local/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-modules/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-context/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf/tex/generic/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "d:/Lukas/Lua/?.lua" resolvers > libraries > ! locating "Test" as "Test.lua" on "lua" paths resolvers > libraries > ! checking for "Test.lua" using "lua" path "." resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/context/lua/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/luatex/lua/" resolvers > libraries > ! checking for "Test.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/lua/" resolvers > libraries > ! locating "Test" as "Test.dll" on "lib" paths resolvers > libraries > ! checking for "Test.dll" using "lib" path "." resolvers > libraries > ! checking for "Test.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/context/lua/" resolvers > libraries > ! checking for "Test.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/luatex/lua/" resolvers > libraries > ! checking for "Test.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/lua/" resolvers > libraries > ! locating "Test" using normal loader resolvers > libraries > ? unable to locate library "Test" ! LuaTeX error <main ctx instance>:2: module 'Test' not found: no field package.preload['Test'] no file 'Test.dll' no file 'c:\Program Files\Lua\5.1\clibs\Test.dll' no file 'C:\Lukas\Lua\Test.dll' stack traceback: [C]: in function 'require' <main ctx instance>:2: in main chunk. system > tex > error on line 5 in file C:/Lukas/Jobs/HubI-ISK.DSP/SO_210/Statics.Tx/t.mkiv: LuaTeX error ... 1 \enabletrackers[resolvers.libraries] 2 3 \startluacode 4 require "Test" 5 >> \stopluacode 6 7 \starttext 8 A 9 \stoptext 10 } require "Test"...\zerocount { \luat_start_lua_code_indeed ...ua \zerocount {#1}} " Weird that there is line: " resolvers > libraries > ! checking for "Test.lua" using "lua" path "d:/Lukas/Lua/?.lua" " in the output log but "d:\Lukas\Lua\Test.lua" is not found here (?!). So - ? Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 23-10-2012 16:37, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
resolvers > libraries > ! checking for "Test.lua" using "lua" path "d:/Lukas/Lua/?.lua" "
in the output log but "d:\Lukas\Lua\Test.lua" is not found here (?!).
So - ?
no clue ... maybe an error in test.lua ---------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, 23 Oct 2012 16:53:01 +0200, Hans Hagen
On 23-10-2012 16:37, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
resolvers > libraries > ! checking for "Test.lua" using "lua" path "d:/Lukas/Lua/?.lua" "
in the output log but "d:\Lukas\Lua\Test.lua" is not found here (?!).
So - ?
no clue ... maybe an error in test.lua
... Have you seen the content of "Test.lua"? It just prints some text... When I downgraded Ctx to the previous installed version, it works... Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 23-10-2012 16:58, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
On Tue, 23 Oct 2012 16:53:01 +0200, Hans Hagen
wrote: On 23-10-2012 16:37, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
resolvers > libraries > ! checking for "Test.lua" using "lua" path "d:/Lukas/Lua/?.lua" "
in the output log but "d:\Lukas\Lua\Test.lua" is not found here (?!).
So - ?
no clue ... maybe an error in test.lua
.... Have you seen the content of "Test.lua"? It just prints some text...
When I downgraded Ctx to the previous installed version, it works...
When I make e:\tmp\whatever.lua (current path) e:\tmp\whatever\something.lua And run \starttext \enabletrackers[resolvers.libraries] \startluacode print("LUAINPUTS",os.getenv("LUAINPUTS")) require("whatever") ; require("something") ; \stopluacode \stoptext i get LUAINPUTS e:/tmp/whatever resolvers > libraries > ! locating "whatever" as "whatever.lua" using formats "texlua" resolvers > libraries > ! checking for "whatever.lua"' using format "tex" resolvers > libraries > ! lib "whatever.lua" located on "whatever.lua" whatever resolvers > libraries > ! locating "something" as "something.lua" using formats "texlua" resolvers > libraries > ! checking for "something.lua"' using format "tex" resolvers > libraries > ! checking for "something.lua"' using format "lua" resolvers > libraries > ! lib "something.lua" located on "e:/tmp/whatever/something.lua" something so it must be something with your path spec ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello,
When I make
e:\tmp\whatever.lua (current path) e:\tmp\whatever\something.lua
And run
\starttext
\enabletrackers[resolvers.libraries]
\startluacode print("LUAINPUTS",os.getenv("LUAINPUTS"))
require("whatever") ; require("something") ; \stopluacode
\stoptext
i get
LUAINPUTS e:/tmp/whatever resolvers > libraries > ! locating "whatever" as "whatever.lua" using formats "texlua" resolvers > libraries > ! checking for "whatever.lua"' using format "tex" resolvers > libraries > ! lib "whatever.lua" located on "whatever.lua" whatever resolvers > libraries > ! locating "something" as "something.lua" using formats "texlua" resolvers > libraries > ! checking for "something.lua"' using format "tex" resolvers > libraries > ! checking for "something.lua"' using format "lua" resolvers > libraries > ! lib "something.lua" located on "e:/tmp/whatever/something.lua" something
so it must be something with your path spec
it seems that I solved the problem finally. Normally, the LUA_PATH contains members like "D:\Lukas\Lua\?.lua", whilst LUAINPUTS has form of "e:/tmp/whatever", so there are three differences: 1) drive letter is upper-case in my case, lower case in Hans' one, 2) I'm using backslashes '\' in path description, Hans uses '/', 3) my LUAINPUTS path contains "?.lua" and "?.clua" strings, which are typical for pure Lua scripts with LUA_PATH (and "?.dll" with LUA_CPATH), whilst Hans' LUAINPUTS doesn't contain these strings. So I started to check influence of these three differences... It seems that #3 is fatal - "?.[c]lua" must not be a part of the path; although it's been working so far. So - if anyone interested - I modified slightly my Ctx-initializing batch '_InitCtx.bat': ---- set PATH=c:\ConTeXt\tex\texmf-mswin\bin;%PATH% :: The lowercase "c:" if fatally necesssary! set LUAINPUTS=%LUAINPUTS%;%LUA_PATH% :: >= 10/2012 set LUAINPUTS=%LUAINPUTS:?.luac=% set LUAINPUTS=%LUAINPUTS:?.lua=% :: >= 24.10.2012 ---- It seems also that Ctx accepts both "a/b/c" and "a/b/c/" forms of LUAINPUTS members, i.e. with or without the trailing (back)slash. Thanks, Hans, for your detailed testing - the signal "LUAINPUTS e:/tmp/whatever" directed me to the solution. Best regards, Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
On 24-10-2012 11:21, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
1) drive letter is upper-case in my case, lower case in Hans' one,
should be ok
2) I'm using backslashes '\' in path description, Hans uses '/',
should work out ok too, windows internally accepts both but in the end context normalizes to / (i always use / anyway as that works on all platforma)
3) my LUAINPUTS path contains "?.lua" and "?.clua" strings, which are typical for pure Lua scripts with LUA_PATH (and "?.dll" with LUA_CPATH), whilst Hans' LUAINPUTS doesn't contain these strings.
It seems that #3 is fatal - "?.[c]lua" must not be a part of the path; although it's been working so far.
So - if anyone interested - I modified slightly my Ctx-initializing batch '_InitCtx.bat':
indeed, as LUAINPUTS is a path specification cf web2c/tds
It seems also that Ctx accepts both "a/b/c" and "a/b/c/" forms of LUAINPUTS members, i.e. with or without the trailing (back)slash.
yes, quite some some cleanup happens deep down Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Thu, 04 Oct 2012 13:27:40 +0200, Hans Hagen
On 4-10-2012 12:09, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Personally - I've been using "require <file-name>" so far at many places and there was no problem with it.
try with
\enabletrackers[resolvers.libraries]
- OK - ---- \enabletrackers[resolvers.libraries] \startluacode require "Test-U" \stopluacode \starttext A \stoptext ---- - I'm getting: " C:\Lukas\ConTeXt\Test>t-Req.mkiv C:\Lukas\ConTeXt\Test>set PATH=c:\ConTeXt\tex\texmf-mswin\bin;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Autodesk Shared\;C:\PROGRA~1\COMMON~1\AUTODE~1\GIS\IMPORT~1\1.0;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Lua\5.1;C:\Program Files\Lua\5.1\clibs;C:\Lukas\..\Programs.Con\Ponton;C:\Program Files\Pandoc\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Tesseract-OCR;C:\Lukas/Bat ;C:\Lukas/../Programs.Con;;C:\PROGRA~1\COMMON~1\AUTODE~1 C:\Lukas\ConTeXt\Test>rem The lowercase "c:" if fatally necesssary! C:\Lukas\ConTeXt\Test>set TEXMFHOME=;C:\Lukas\ConTeXt\Fonts mtx-context | run 1: luatex --fmt="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en" --interaction="nonstopmode" --jobname="t-Req" --lua="c:/ConTeXt/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/cont-en.lui" --no-parse-first-line --c:FILE="t-Req.mkiv" --c:currentrun=1 --c:fulljobname="C:/Lukas/ConTeXt/Test/t-Req.mkiv" --c:halt-on-error --c:input="C:/Lukas/ConTeXt/Test/t-Req.mkiv" --c:kindofrun=1 --c:mode="t-Req" --c:nonstopm ode "cont-yes.mkiv" This is LuaTeX, Version beta-0.70.2-2012092822 (TeX Live 2012/W32TeX) \write18 enabled. (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-yes.mkiv ConTeXt ver: 2012.10.02 22:03 MKIV fmt: 2012.10.4 int: english/english system > cont-new.mkiv loaded (c:/ConTeXt/tex/texmf-context/tex/context/base/cont-new.mkiv system > beware: some patches loaded from cont-new.mkiv ) fonts > latin modern fonts are not preloaded languages > language en is active (C:/Lukas/ConTeXt/Test/t-Req.mkiv resolvers > libraries > ! locating "Test-U" as "Test-U.lua" using formats "texlua" resolvers > libraries > ! checking for "Test-U.lua"' using format "tex" resolvers > libraries > ! checking for "Test-U.lua"' using format "lua" resolvers > libraries > ! locating "Test-U" as "Test-U.dll" using formats "lib" resolvers > libraries > ! checking for "Test-U.dll"' using format "lib" resolvers > libraries > ! locating "Test-U" as "Test-U.lua" on "lua" paths resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "." resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "C:/Lukas/ConTeXt/Fonts" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-project" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-fonts" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-local" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-modules" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-context" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf/tex/context/" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "/tex/plain/base/" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "/tex/generic/" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf/scripts/context/lua/" resolvers > libraries > ! locating "Test-U" as "Test-U.lua" on "lua" paths resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "." resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/context/lua/" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/luatex/lua/" resolvers > libraries > ! checking for "Test-U.lua" using "lua" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/lua/" resolvers > libraries > ! locating "Test-U" as "Test-U.dll" on "lib" paths resolvers > libraries > ! checking for "Test-U.dll" using "lib" path "." resolvers > libraries > ! checking for "Test-U.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/context/lua/" resolvers > libraries > ! checking for "Test-U.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/luatex/lua/" resolvers > libraries > ! checking for "Test-U.dll" using "lib" path "c:/ConTeXt/tex/texmf-mswin/bin/lib/lua/" resolvers > libraries > ! locating "Test-U" using normal loader resolvers > libraries > ? unable to locate library "Test-U" ! LuaTeX error <main ctx instance>:2: module 'Test-U' not found: no field package.preload['Test-U'] no file 'Test-U.dll' no file 'c:\Program Files\Lua\5.1\clibs\Test-U.dll' no file 'C:\Lukas\Lua\Test-U.dll' stack traceback: [C]: in function 'require' <main ctx instance>:2: in main chunk. system > tex > error on line 5 in file C:/Lukas/ConTeXt/Test/t-Req.mkiv: LuaTeX error ... 1 \enabletrackers[resolvers.libraries] 2 3 \startluacode 4 require "Test-U" 5 >> \stopluacode 6 7 \starttext 8 A 9 \stoptext 10 } require "Test-U".erocount { \luat_start_lua_code_indeed ...ua \zerocount {#1}} l.5 \stopluacode ... "
btw, you should adapt LUAINPUTS and not some other environment variable
OK, so what does it mean practically? Should I define a new system variable LUAINPUTS to have similar content as LUA_PATH and LUA_CPATH are having? Or LUAINPUTS is a (Con|Lua)TeX(t) internal variable and should be modified another way? Lukas -- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038
participants (3)
-
Hans Hagen
-
luigi scarso
-
Procházka Lukáš Ing. - Pontex s. r. o.