[luatex] TeX-Lua interaction
Dirk Laurie
dirk.laurie at gmail.com
Wed Sep 12 08:43:04 CEST 2012
2012/9/11 Dirk Laurie <dirk.laurie at gmail.com>:
> addr = {
> {"James",[[
> James Bond
> c/o MI5
> London]]},
> {"Ian",[[
> Ian Fleming
> Elysian Fields]]}
> }
>
> letters = {}
>
> for i=1,#addr do letters[#letters+1]=letter:format(addr[i][2],addr[i][1]) end
If you don't care about the order in which the letters come out, the
following is more convenient:
addr = { James = [[
James Bond
c/o MI5
London
]]},
Ian = [[
Ian Fleming
Elysian Fields
]]},
}
letters = {}
for N,A in pairs(addr) do letters[#letters+1]=letter:format(N,A) end
There should of course be "return letters" as suggested by the demo.
More information about the luatex
mailing list