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 “parameter.watch” 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
_G["ElapsedTime"]. Thus you can store
var = "ElapsedTime" and then later on look at
_G[var] to get the up to date value of
(More complicated solutions exist using
loadstring which is lua’s version of
Thanks! That is exactly what i wanted… Using _G was enough.