Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-16 Thread Rudolf Bahr
tandalone lua typically sees only one chunk (the file you pass on the > > command > > line) but embedded lua implementation often see (sometimes many) more > > chunks. > > In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that > > means every > > \s

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Hans Hagen
see (sometimes many) more chunks. In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means every \startluacode block and every \ctxlua call is a separate chunk). The only unusual thing here is that standalone lua silently quits and returns a non-zero exit code to the shell,

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Taco Hoekwater
times many) more chunks. In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means every \startluacode block and every \ctxlua call is a separate chunk). The only unusual thing here is that standalone lua silently quits and returns a non-zero exit code to the shell, whereas lu

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
st do > > f = io.open(...) > If f then ... else ... end > > Best wishes, > Taco Hi Taco! Thank you again for your message! My wish isn't to avoid error messages, if they are justified! In the case of my MWE I want to have a decision in my \startluacode ... \stopluacode e

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi, > On 14 Oct 2019, at 21:08, Rudolf Bahr wrote: > > > 2. But in the case of an not existing file (BBB.lua) the known error message > comes up > again: > "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No such > file or >directory". >This, of course, is true,

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
On Mon, Oct 14, 2019 at 07:19:53PM +0200, Hans Hagen wrote: > On 10/14/2019 6:50 PM, Rudolf Bahr wrote: > > THis MWE must be faulty, but where is the error? > > > > ==== > > > > \startluacode > > > >

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Hans Hagen
On 10/14/2019 6:50 PM, Rudolf Bahr wrote: Dear List! THis MWE must be faulty, but where is the error? \startluacode userdata = userdata or {} function userdata.file_exists (name) local name = name local f= assert ( io.open

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi, > On 14 Oct 2019, at 18:51, Rudolf Bahr wrote: > >  > Dear List! > > THis MWE must be faulty, but where is the error? > > === > \lookupfile{"$HOME/context-tests/AAA.lua"}% "AAA.lua" intentionally does > exist $HOME is an actual lit

[NTG-context] RE : \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Joseph
I suspect the double quotes are part of file names, hence files cannot be found. Perhaps try remove them in macro argument. Hope this helps De : Rudolf Bahr Envoyé le :lundi 14 octobre 2019 18:50 À : ntg-context@ntg.nl Objet :[NTG-context] \ctxlua and \startluacode ... \stopluacode Dear List

[NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
Dear List! THis MWE must be faulty, but where is the error? \startluacode userdata = userdata or {} function userdata.file_exists (name) local name = name local f= assert ( io.open ( name, "r" )) if f then

Re: [NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Hans Hagen
On 4-9-2012 15:40, Marco Patzer wrote: Hi, the luacode environment chokes on macro names with underscores. Example: \starttext \unprotect \def\number_two{two} \startluacode userdata = userdata or { } function userdata.number_one() context("one") end -- works userdata.

Re: [NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Wolfgang Schuster
Am 04.09.2012 um 15:40 schrieb Marco Patzer : > Hi, > > the luacode environment chokes on macro names with underscores. > Example: > > \starttext > \unprotect > > \def\number_two{two} > > \startluacode > userdata = userdata or { } > function u

[NTG-context] \startluacode and macro names with underscores

2012-09-04 Thread Marco Patzer
Hi, the luacode environment chokes on macro names with underscores. Example: \starttext \unprotect \def\number_two{two} \startluacode userdata = userdata or { } function userdata.number_one() context("one") end -- works userdata.number_one() -- fails -- context.

Re: [NTG-context] LuaTeX Function Arguments Variables Parameters List ConTeXt Lua \startluacode

2012-01-27 Thread Mathieu Dupont
Great, thank you very much Philipp. I will also read this page you pointed and I should understand better Lua then. http://wiki.contextgarden.net/table_manipulation Mathieu _

Re: [NTG-context] LuaTeX Function Arguments Variables Parameters List ConTeXt Lua \startluacode

2012-01-27 Thread Philipp Gesang
es are references. Using the “local” keyword, you generate a local variable that still points to the original table. Instead, you need to (deep) copy the table explicitly. · \starttext \startluacode function myFunc(arg) local

[NTG-context] LuaTeX Function Arguments Variables Parameters List ConTeXt Lua \startluacode

2012-01-27 Thread Mathieu Dupont
int ! Mathieu \starttext \startluacode function myFunc(arg) local var = arg var[1] = var[1] + 3 return var end local a = {1,2} context("a = \\{") context(a[1]) context(",\\;") context(a[2]) context("\\}\\par") context("\\blank"

Re: [NTG-context] Stange behavior of \startluacode

2010-10-05 Thread Aditya Mahajan
On Sun, 3 Oct 2010, Hans Hagen wrote: On 3-10-2010 1:46, Aditya Mahajan wrote: Hi, The following snippet \startluacode -- \undefined why should a comment matter a = 10 \stopluacode fails with system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why sho

Re: [NTG-context] Stange behavior of \startluacode

2010-10-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello, my observation: --- \starttext AAA \startluacode a = 10 context(a) -- a = 20 context(a) \stopluacode \stoptext --- - works OK, 'AAA', '10' and '20' is printed. If I modify the code: --- \starttext AAA \startluacode a

Re: [NTG-context] Stange behavior of \startluacode

2010-10-04 Thread Hans Hagen
On 4-10-2010 9:19, Procházka Lukáš Ing. - Pontex s. r. o. wrote: (Sorry, I've written bad information, now correcting (*)...) Hello, my observation: --- \starttext AAA \startluacode a = 10 context(a) -- a = 20 context(a) \stopluacode \stoptext --- - works OK, 'AAA'

Re: [NTG-context] Stange behavior of \startluacode

2010-10-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .
(Sorry, I've written bad information, now correcting (*)...) Hello, my observation: --- \starttext AAA \startluacode a = 10 context(a) -- a = 20 context(a) \stopluacode \stoptext --- - works OK, 'AAA', '10' and '10' (*

Re: [NTG-context] Stange behavior of \startluacode

2010-10-03 Thread Hans Hagen
On 3-10-2010 1:46, Aditya Mahajan wrote: Hi, The following snippet \startluacode -- \undefined why should a comment matter a = 10 \stopluacode fails with system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluac

Re: [NTG-context] Stange behavior of \startluacode

2010-10-03 Thread Wolfgang Schuster
The problem is that there is no solution to write something expandable (because \startluacode expands the content) which is required here. > \starttext > > \bgroup\obeylines > \gdef\texcomment#1 > {} > \egroup > > \bgroup > \let\letterhyphen=- > \catcode`-=13 >

Re: [NTG-context] Stange behavior of \startluacode

2010-10-03 Thread Wolfgang Schuster
Am 03.10.2010 um 10:28 schrieb luigi scarso: >> Bug or limitation? > Limitation, but it should be doable to remedy in TeX. Possible but is it worth the effort, when you start with “--” the percent should also behave like in Lua etc. \starttext \bgroup\obeylines \gdef\texcomment#1 {} \egroup

Re: [NTG-context] Stange behavior of \startluacode

2010-10-03 Thread luigi scarso
On Sun, Oct 3, 2010 at 1:46 AM, Aditya Mahajan wrote: > Hi, > > The following snippet > > \startluacode >  -- \undefined why should a comment matter >  a = 10 > \stopluacode > > fails with > > system          > error on line 4 in file bug.tex: Undefined

Re: [NTG-context] Stange behavior of \startluacode

2010-10-02 Thread Wolfgang Schuster
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan: > Hi, > > The following snippet > > \startluacode > -- \undefined why should a comment matter > a = 10 > \stopluacode > > fails with > > system > error on line 4 in file bug.tex: Undefined

Re: [NTG-context] Stange behavior of \startluacode

2010-10-02 Thread Wolfgang Schuster
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan: > Hi, > > The following snippet > > \startluacode > -- \undefined why should a comment matter > a = 10 > \stopluacode > > fails with > > system > error on line 4 in file bug.tex: Undefined c

[NTG-context] Stange behavior of \startluacode

2010-10-02 Thread Aditya Mahajan
Hi, The following snippet \startluacode -- \undefined why should a comment matter a = 10 \stopluacode fails with system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a =

Re: [NTG-context] Strings [[...]] inside \startluacode \stopluacode

2010-04-26 Thread Taco Hoekwater
Jaroslav Hajtmar wrote: Where is a problem? Is there any solutions with [[ ... ]] Category codes, of course. :) \startluacode leaves the backslash at category code 0, and expands its argument so that you can use TeX macros inside the environment (which is normally what is wanted). The

[NTG-context] Strings [[...]] inside \startluacode \stopluacode

2010-04-26 Thread Jaroslav Hajtmar
) then script does work OK, but when string is inside \startluacode \stopluacode environment, then does work only when i use text string inside ' ' for example: luastring='\\def\\texmacro\#1\{\\directlua\{luafunction(\#1)\}\}' Script does not work when i use text inside