lua-users home
lua-l archive

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


Hello,

If I have a string containing the path to a varialble, for example:

> n1={n2="hello"}
> =n1.n2
hello
> path_to_n2="n1.n2"
> print(path_to_n2)
n1.n2
>

Given variable path_to_n2, how can I get the value of n1.n2 ?

I know if I use C, I can use lua_getglobal(), but if there is a way to do it in pure Lua?

I'm a Lua newbie, sorry if it's a silly question. ;)

Regards,
Xu