[latex3-commits] [git/LaTeX3-latex3-latex3] luaintarray: Move \@@_to_clist:Nn to Lua (0e50de14e)
Marcel Fabian Krüger
tex at 2krueger.de
Sun Nov 7 06:04:08 CET 2021
Repository : https://github.com/latex3/latex3
On branch : luaintarray
Link : https://github.com/latex3/latex3/commit/0e50de14e3089d84d6b395c48c756d0166be78bb
>---------------------------------------------------------------
commit 0e50de14e3089d84d6b395c48c756d0166be78bb
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sun Nov 7 06:04:08 2021 +0100
Move \@@_to_clist:Nn to Lua
>---------------------------------------------------------------
0e50de14e3089d84d6b395c48c756d0166be78bb
l3kernel/l3intarray.dtx | 27 ++++++++++-----------------
l3kernel/testfiles/m3intarray001.luatex.tlg | 4 ++--
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/l3kernel/l3intarray.dtx b/l3kernel/l3intarray.dtx
index 5ac27da6a..101d548a2 100644
--- a/l3kernel/l3intarray.dtx
+++ b/l3kernel/l3intarray.dtx
@@ -503,23 +503,15 @@ end, 'global')
% \begin{macrocode}
\cs_new:Npn \intarray_to_clist:N #1 { \@@_to_clist:Nn #1 { , } }
\cs_generate_variant:Nn \intarray_to_clist:N { c }
-\cs_new:Npn \@@_to_clist:Nn #1#2
- {
- \int_compare:nNnF { \intarray_count:N #1 } = \c_zero_int
- {
- \exp_last_unbraced:Nf \use_none:n
- { \@@_to_clist:w 1 ; #1 {#2} \prg_break_point: }
- }
- }
-\cs_new:Npn \@@_to_clist:w #1 ; #2#3
- {
- \if_int_compare:w #1 > \intarray_count:N #2 ~
- \prg_break:n
- \fi:
- #3 \__kernel_intarray_item:Nn #2 {#1}
- \exp_after:wN \@@_to_clist:w
- \int_value:w \int_eval:w #1 + \c_one_int ; #2 {#3}
- }
+%</tex>
+%<*lua>
+local concat = table.concat
+luacmd('@@_to_clist:Nn', function()
+ local t = @@_table()
+ local sep = token.scan_string()
+ sprint(-2, concat(t, sep))
+end, 'global')
+%</lua>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -527,6 +519,7 @@ end, 'global')
% \begin{macro}[rEXP]{\__kernel_intarray_range_to_clist:Nnn, \@@_range_to_clist:ww}
% Loop through part of the array.
% \begin{macrocode}
+%<*tex>
\cs_new:Npn \__kernel_intarray_range_to_clist:Nnn #1#2#3
{
\exp_last_unbraced:Nf \use_none:n
diff --git a/l3kernel/testfiles/m3intarray001.luatex.tlg b/l3kernel/testfiles/m3intarray001.luatex.tlg
index ecbc49d9d..9717cf9c6 100644
--- a/l3kernel/testfiles/m3intarray001.luatex.tlg
+++ b/l3kernel/testfiles/m3intarray001.luatex.tlg
@@ -75,11 +75,11 @@ TEST 5: Zeroing
============================================================
0,0,24,0,0,0,0,28,0,0
The integer array \g_testd_intarray contains 10 items:
-> 0, 0, 24, 0, 0, 0, 0, 28, 0, 0.
+> 0, 0, 24, 0, 0, 0, 0, 28, 0, 0.
24
0,0,0,0,0,0,0,20,0,0
The integer array \g_testd_intarray contains 10 items:
-> 0, 0, 0, 0, 0, 0, 0, 20, 0, 0.
+> 0, 0, 0, 0, 0, 0, 0, 20, 0, 0.
<recently read> }
l. ... }
0
More information about the latex3-commits
mailing list.