lua-users home
lua-l archive

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


Hi, All,

I have a prototype table for substituting character strings with UTF8
characters:

  local tSub = {
["%-%-%-"] = "—",
["%-%-"] = "–",
["%.%.%."] = " … "}

My problem is that the first key/value pair must be processed before
the second key/value pair because of overlapping characters in the
keys, but the order in which Lua returns table key/value pairs is
unpredictable, leading to buggy results in the substitutions.

Eventually the script would make many other substitutions, but I seem
to be stuck here at the prototype stage because of the unpredictable
return order.

How might I work around this?

Best regards,

Paul

-- 
[Notice not included in the above original message:  The U.S. National
Security Agency neither confirms nor denies that it intercepted this
message.]