Store a variable name on a table, no its value. The, evaluate its current value.

I want a class store a string on a table. Then, this class should ask the table what variable to get a value from.
Something like what “” does.

By example, from ElapsedTime. When i try to do this, the class store on the table the current ElapsedTime value, but it not changes.

In other languages, is like Eval(variable) function.

I’m not sure I have understood completely what you want, but this might be along the right lines.

You can access global variables via the _G table. So ElapsedTime is _G["ElapsedTime"]. Thus you can store var = "ElapsedTime" and then later on look at _G[var] to get the up to date value of ElapsedTime.

(More complicated solutions exist using loadstring which is lua’s version of eval.)

Thanks! That is exactly what i wanted… Using _G was enough.