[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Turning a string into a variable
- From: "Curt Carpenter" <curtc@...>
- Date: Thu, 1 May 2003 13:06:58 -0700
>> Let's say:
>>
>> x = "foo"
>>
>> But now I want to see if foo itself is an assigned variable (i.e. foo
>> ~= nil --- but since I don't know the sting contained in x, I can't
>> do this directly)
>Try getglobal(x).
Or more generically (supporting the case where the string contained a
function call or any other expression):
result = dostring("return " .. x)
Of course you have to be prepared for an error if x is not a valid
expression.
Curt