[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: This is Lua, not Haskell (562ccec)

Marcel Fabian Krüger tex at 2krueger.de
Thu Feb 13 11:40:47 CET 2020


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/562ccecf9e932ffc8676a4f04f97151af9aef6c2

>---------------------------------------------------------------

commit 562ccecf9e932ffc8676a4f04f97151af9aef6c2
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Thu Feb 13 11:40:47 2020 +0100

    This is Lua, not Haskell


>---------------------------------------------------------------

562ccecf9e932ffc8676a4f04f97151af9aef6c2
 src/luaotfload-tool.lua | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index 643a05f..96e9047 100644
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -1238,29 +1238,19 @@ end
 ---
 ---         --list=<criterion>          --fields=<f1>,<f2>,<f3>,...<fn>
 
-local function get_fields (entry, fields, acc, n)
-    if not acc then
-        return get_fields (entry, fields, { }, 1)
-    end
-
-    local field = fields [n]
-    if field then
+local function get_fields (entry, fields)
+    local acc = {}
+    for n, field in ipairs(fields) do
         local chain = stringsplit (field, "->")
         local tmp   = entry
-        for i = 1, #chain - 1 do
+        for i = 1, #chain do
             tmp = tmp [chain [i]]
             if not tmp then
                 --- invalid field
                 break
             end
         end
-        if tmp then
-            local value = tmp [chain [#chain]]
-            acc[#acc+1] = value or false
-        else
-            acc[#acc+1] = false
-        end
-        return get_fields (entry, fields, acc, n+1)
+        acc[n] = tmp or false
     end
     return acc
 end





More information about the latex3-commits mailing list.