[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Translate String of Variable Name into Variable Value
- From: spam@...
- Date: Fri, 1 Jun 2007 07:02:49 -0700 (PDT)
I'm trying to expand some existing LUA code in a project. Below is a
simplified version of an existing function to explain what I'm after:
const foo = 4
return a == b
I need to write an equivalent function that does the same as
The value being passed to me for "a" the string name of one of several
pre-declared constants, like "foo" above.
The value being passed for "b" is an integer value out of the set of
possible constants above, in this case "4".
What I want to do is translate variable "a" from the string "foo" into its
equivalent named variable value of "4", so that:
TIA for help. I'm missing something obvious, aren't I?