[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Translate String of Variable Name into Variable Value
- From: spam@...
- Date: Fri, 1 Jun 2007 07:28:33 -0700 (PDT)
Thanks. The "const" is part of a class definition. I left
that bit out for simplification, but the distinction may be
important. Can I still access the value through _G ?
----- Original Message -----
From: "Ketmar Dark" <email@example.com>
Sent: Friday, June 01, 2007 8:18 AM
Subject: Re: Translate String of Variable Name into Variable
On Fri, 1 Jun 2007 07:02:49 -0700 (PDT)
> const 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
tables. and you can do something like:
function CompareVar (varname, value)
return _G[varname] == value;
this is identical to simple "varname == value" construction.