[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table key starting with backslash
- From: Christopher Kappe <nox_diesque@...>
- Date: Sun, 1 Nov 2015 10:43:46 +0100
Still wondering if anyone can say sth. regarding this topic.
If the escape character "\" isn't allowed as first character in a string
key, it should be stated somewhere. Also, I would be interested in an
explanation why it is like that.
Am 09.10.2015 um 11:36 schrieb Christopher Kappe:
> 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
>