Hello, I am sorry, I am novice in this maillist and in Lua(TeX) too. I dont know if my problem isn't off topic. My inquiry is here: Is it make possible with variables in Lua(TeX) do for similar "hara-kiri" like in Perl or PHP by this example?: $a="b"; $$a="456"; print $b; # result 456 $varname="counter"; $varindex=1; ${"$varname$varindex"}=123; print $counter1; # result 123 Is any alternative of this examples in Lua what should be using in LuaTex?? thanks Jaroslav Hajtmar
Jaroslav Hajtmar wrote:
Hello, I am sorry, I am novice in this maillist and in Lua(TeX) too. I dont know if my problem isn't off topic. My inquiry is here: Is it make possible with variables in Lua(TeX) do for similar "hara-kiri" like in Perl or PHP by this example?:
$a="b"; $$a="456"; print $b; # result 456
There is no symbol dereferencing in lua. This is a good thing(tm), in my opinion. If you want trickery like this, you have to resort to loadstring (which is the lua equivalent of eval) Best wishes, Taco
On Fri, Mar 19 2010, Jaroslav Hajtmar wrote:
$a="b"; $$a="456"; print $b; # result 456
No problem with tables: testtab = {} testtab.a = "b" testtab[testtab.a] = 456 print(testtab.b) -- result 456 Documentation about lua is here: http://www.lua.org/ Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
participants (3)
-
Jaroslav Hajtmar
-
Peter Münster
-
Taco Hoekwater