[luatex] token_filter

Arthur Reutenauer arthur.reutenauer at normalesup.org
Sat Apr 27 11:39:26 CEST 2013


> l.28 of your luaintercharnode.lua, you say:
> 
>     Why the hell can’t I index a table with a table?
> 
> Well, you can :)
> 
>     local t = { [{1, 1}] = emspace }
>     t[{a = b}] = c

  Yes, but observe:

---- cut before
\directlua{ 
  local function log(message)
    texio.write_nl("term and log", message)
  end

  local function say_if_node(n, label)
    if node.is_node(n, label) then
      log(label .. " is a node")
    else
      log(label .. " is NOT a node")
    end
  end

  local t = { }
  local emspace = node.new(node.id('kern'), 1)
  t[{ 1, 1 }] = emspace
  t[1] = emspace

  say_if_node(emspace, "emspace")
  say_if_node(t[{ 1, 1 }], "t[{ 1, 1 }]")
  say_if_node(t[1], "t[1]")
}
---- cut after

prints (amongst others):

----
emspace is a node
t[{ 1, 1 }] is NOT a node
t[1] is a node
----

  So something odd is happening when the table index is a table, which
meant that in practice I couldn't use table as indexes there.

  With LuaTeX 0.70.2 from TeX Live 2012, haven't checked with 0.75.

	Arthur


More information about the luatex mailing list