[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Translate String of Variable Name into Variable Value
- From: Ketmar Dark <ketmar@...>
- Date: Fri, 1 Jun 2007 17:18:44 +0300
On Fri, 1 Jun 2007 07:02:49 -0700 (PDT)
spam@bitlet.com wrote:
> const foo = 4
>
> compare_label("foo",4)
>
> is true.
>
> TIA for help. I'm missing something obvious, aren't I?
there are no "consts" in Lua, but you can emulate constants with proxy
tables. and you can do something like:
function CompareVar (varname, value)
return _G[varname] == value;
end;
this is identical to simple "varname == value" construction.