lua-users home
lua-l archive

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


2012/12/20 Grizzly Bear <6grizzlybear@gmail.com>:


> I'd really want to have the at sign ``@'' in the key of a table, e.g.,
>           tab["var@addr"] = 1.

You can do this.

1. Edit lctype.c so that all characters from 0x80 to 0xbf are digits
    (replace 0x00 by 0x16) and all characters from 0xc0 to 0xfd
    are letters (replace 0x00 by 0x15).  Rebuild Lua.  (This makes
    all multibyte UTF-8 sequences into valid alphabetic characters
    for Lua without opening the floodgates to arbitrary byte strings.)

2. Invent some way that you can easily enter Unicode uFF20 on
    your keyboard, e.g. by pressing Alt-@ (Alt-Shift-2 on my keyboard).

Here is a transcript of an actual session.

$ lua-utf8
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> tab = {}
> tab.var@addr = 1
> for k,v in pairs(tab) do print(k,v) end
var@addr	1