transition.to and parameters! (string to function problem)

hi!

i’m trying to pass a variable to the transition parameter like the example below:

local var1=easing.inExpo

local trans=transition.to(obj,{time=1000, transition=var1})

this works. but when i try to pass json to the variable var1…i can’t make it work anymore. so my trouble is passing from json data to work with transition parameter.

my json file have something like this:

[

    {

      

“trans”: “easing.inExpo”

    }

]

i know that "easing.inExpo is passed as a string. how can i convert it to pass as a function?

i know a workaround…i can use something like this:

if var.trans==“easing.inExpo” then var1=easing.inExpo…and so on to all easings…but this looks so bad programming that i’m saving this solution for last.

if anyone have a better idea, i appreciate. i tried other metods that i read in the forums, tryingy to pass string to tables…but in this case still dont work.

If you just store the ‘inExpo’ part as a string, then could you just call:

[lua]

local trans=transition.to(obj,{ time=1000, transition=easing[var.trans] })

[/lua]

thank you very much :slight_smile:

that did work.

still if anyone have any other solutions please fell free to share.

If you just store the ‘inExpo’ part as a string, then could you just call:

[lua]

local trans=transition.to(obj,{ time=1000, transition=easing[var.trans] })

[/lua]

thank you very much :slight_smile:

that did work.

still if anyone have any other solutions please fell free to share.