* directlua question
@ 2018-12-04 12:29 Hans van der Meer
2018-12-04 12:41 ` Hans van der Meer
2018-12-04 12:44 ` Wolfgang Schuster
0 siblings, 2 replies; 3+ messages in thread
From: Hans van der Meer @ 2018-12-04 12:29 UTC (permalink / raw)
To: NTG ConTeXt
[-- Attachment #1.1: Type: text/plain, Size: 406 bytes --]
I am trying to extract something from a string with a \directlua call, the last word of a string in case:
\directlua{tex.print(string.match(“This is a string","%s%a$"))}
However, the %s%a are not working with the TeX-error “unfinished string near eof”. Obviously caused by the %’s.
How to get this working? \textpercent will not do, off course within Luacode.
dr. Hans van der Meer
[-- Attachment #1.2: Type: text/html, Size: 1718 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 bytes --]
___________________________________________________________________________________
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
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: directlua question
2018-12-04 12:29 directlua question Hans van der Meer
@ 2018-12-04 12:41 ` Hans van der Meer
2018-12-04 12:44 ` Wolfgang Schuster
1 sibling, 0 replies; 3+ messages in thread
From: Hans van der Meer @ 2018-12-04 12:41 UTC (permalink / raw)
To: NTG ConTeXt
[-- Attachment #1.1: Type: text/plain, Size: 630 bytes --]
On 4 Dec 2018, at 13:29, Hans van der Meer <havdmeer@ziggo.nl> wrote:
> I am trying to extract something from a string with a \directlua call, the last word of a string in case:
>
> \directlua{tex.print(string.match(“This is a string","%s%a$"))}
>
> However, the %s%a are not working with the TeX-error “unfinished string near eof”. Obviously caused by the %’s.
> How to get this working? \textpercent will not do, off course within Luacode.
Also I tried to no avail
\begingroup\catcode`\%=12\relax\directlua{tex.print(string.match(“This is a string","%s%a$"))}\endgroup
dr. Hans van der Meer
[-- Attachment #1.2: Type: text/html, Size: 2366 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 bytes --]
___________________________________________________________________________________
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
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: directlua question
2018-12-04 12:29 directlua question Hans van der Meer
2018-12-04 12:41 ` Hans van der Meer
@ 2018-12-04 12:44 ` Wolfgang Schuster
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2018-12-04 12:44 UTC (permalink / raw)
To: mailing list for ConTeXt users, Hans van der Meer
Hans van der Meer schrieb am 04.12.18 um 13:29:
> I am trying to extract something from a string with a \directlua call,
> the last word of a string in case:
>
> \directlua{tex.print(string.match(“This is a string","%s%a$"))}
>
> However, the %s%a are not working with the TeX-error “unfinished string
> near eof”. Obviously caused by the %’s.
> How to get this working? \textpercent will not do, off course within
> Luacode.
% = \letterpercent
$ = \letterdollar
You can also replace
\directlua{tex.print(...)}
with
\ctxlua{context(...)}
or
\cldcontext{...}
Wolfgang
___________________________________________________________________________________
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
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-04 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 12:29 directlua question Hans van der Meer
2018-12-04 12:41 ` Hans van der Meer
2018-12-04 12:44 ` Wolfgang Schuster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).