lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I think I stumbled upon an error in the Lua parser or at least in the
manual.
I want to write a table mapping from special characters given in their
LaTeX representation to the utf8 character. Like this (using the well
known syntactic sugar for string keys):

local latexToUtf8 = {
  \\\"a = "ä", -- without escaping: \"a
  \\\"o = "ö"
  -- etc.
}

This does not compile! However, this works:

local latexToUtf8 = {
  ["\\\"a"] = "ä",
  ["\\\"o"] = "ö"
}

This contradicts the following sentence from
http://www.lua.org/manual/5.3/manual.html
A field of the form name = exp is equivalent to ["name"] = exp.

Because all accents combined with all possible letters makes a large
number, this table is going to be quite long, so I would really be happy
if I could save the [""]

Regards
Christopher