Hello people, after write my ask I find the answer. I put the code in case it is interesting for any persons, Thank you
rec = display.newRect(0,0,100,100) rec.x = 100 rec.y = 100
local cont = 1
local resp = 0
local function finCiclo ()
resp=0
end
local function moverX( num )
resp =1
transition.to(rec, {time = 500, x = rec.x+num, onComplete = finCiclo})
end
local function moverY( num )
resp =1
transition.to(rec, {time = 500, y = rec.y+num, onComplete = finCiclo})
end
local function movAcciones (vector)
local vec = vector
local function vector (event)
print (vec[cont], vec [cont+1])
if vec[cont] == 0 then timer.cancel (event.source) end
if vec[cont] == 1 and resp == 0 then moverX (vec[cont+1]) cont = cont +2 end
if vec[cont] == 2 and resp == 0 then moverY (vec[cont+1]) cont = cont +2 end
end
timer.performWithDelay( 1000, vector, 0 )
end
local vec = {1,45,2,30,2,-15,1,100,0}
movAcciones (vec)