lua-users home
lua-l archive

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


>print(getglobal(MyString))
10
>

/e

----- Original Message ----- 
From: "Markus Huber" <pulse@evolution.org>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Tuesday, January 08, 2002 4:08 PM
Subject: Strings as Variables


> How is it possible to check/use/access the value of a variable if the
> variablename is hold in a stringvariable?
> 
> e.g. MyValue  = 10
>      MyString = 'MyValue'
> 
>      print (MyString) -- should print 10
> 
> Is dostring() the right way? Not as simple as in php:
> 
>      echo ${$MyString};
> 
> also possible with concatenation on the fly:
> 
>      $MyValue  = 10;
>      $MyString = 'My';
> 
>      echo ${$MyString.'Value'};
> 
> 
> Markus
> 
>