[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: At sign ``@'' in key
- From: Michal Kolodziejczyk <miko@...>
- Date: Thu, 20 Dec 2012 09:43:39 +0100
On 20.12.2012 02:26, Grizzly Bear wrote:
> Hi,
>
> I'd really want to have the at sign ``@'' in the key of a table, e.g.,
> tab["var@addr"] = 1.
>
> But I haven't been able to do
> tab.var@addr = 1.
>
> The error message was
> stdin:1: '=' expected near '@'
>
> I'm using Lua 5.1.5. Any suggestions?
Put your key into var:
local key="var@addr"
tab[key]=1
or use:
tab[ [[var@addr]] ]=1
Works for me for both Lua 5.1 and 5.2.
Regards,
miko