Hi Werner,
On Mon, 2025-09-15 at 20:53 +0000, Werner LEMBERG wrote:
> I've come up with the attached solution, which works fine for the
> small example. Not sure whether this is the correct way, though.
A couple small comments:
1. You usually want "luacode*" instead of just "luacode", since only the
"*" environment makes "\" have "other" catcodes.
2. You can freely change the function parameter names, so you can just
do
local function patch_function(fd)
instead of
local function patch_function(fontdata)
local fd = fontdata
3. Lua lets you loop over a table directly, so instead of
local i = 1
while true do
local seq = fd.resources.sequences[i]
local st = seq.steps
for j = 1, #st do
local cov = st[j].coverage
local bc = st[j].baseclasses
for k = 1, #bc do
local bck = bc[k]
some_function(bck)
end
end
i = i + 1
end
you can do
for i, seq in ipairs(fd.resources.sequences[i])
for j, step in ipairs(seq.steps) do
for k, bck in ipairs(step.baseclasses) do
some_function(bck)
end
end
end
Otherwise, it looks good to me.
Thanks,
-- Max