lua-users home
lua-l archive

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


On Jul 17, 2012 10:30 PM, <meino.cramer@gmx.de> wrote:
>
> Hi,
>
> I have the following code via lua -i
>
>     a={}
>     a.bob="alice"
>     keyname="bob"
>
>     =a.keyname
>     nil
>
> Is there a way to access the key of an table, which name is store in
> another variable?
>
> Thank you very much in advance for any help!
>
> Best regards,
> mcc
>
>

You want a[keyname]. a.keyname is equal to a["keyname"].