lua-users home
lua-l archive

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


>> 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