tables and transition.to

Hello -

I was wondering if it is possible to reference a table within a tansition.to statement?

For example, let’s say I have a table with X and Y values (coords)…

local myTable {} myTable[1] = {x=331,y=540} myTable[2] = {x=380,y=675} etc...

Is it possible to reference this table inside a transition.to statement?

For example, I already tried this -

transition.to( displayObj, { x=myTable, y=myTable, xScale=.5, yScale=.5, alpha=1, time=math.random(1000, 2000)})

And it throws an error. So I know it can’t be done that way.

Is there a way to do this? I looked into the DOCS for transition.to and there wasn’t anything about tables, so I am assuming you can’t reference tables with a transition.to statement. Maybe I am wrong? There has to be a way though, right? I sure hope so. :slight_smile:

My goal (concerning all this) is to attach a display object to a (table) path. The path in this case is a table with a  series of X and Y reference points (coords).

I like to learn, so don’t hesitate to get technical in your response or post a long response. Sometimes “short and sweet” just doesn’t cut it. I’m ready to learn.  :D  :lol: 

Thanks in advance. I appreciate the help.

-Joe

When you pass an “x” or “y” value to transition to, it’s expecting a number not a table and “x=myTable,” passes a table in not a number.  What you want is something more like:   x=myTable[1].x

or some way to index myTable with a variable like:

for i = 1, #myTable

     transition.to(… x = myTable[i].x …)

end

Rob

When you pass an “x” or “y” value to transition to, it’s expecting a number not a table and “x=myTable,” passes a table in not a number.  What you want is something more like:   x=myTable[1].x

or some way to index myTable with a variable like:

for i = 1, #myTable

     transition.to(… x = myTable[i].x …)

end

Rob