how to make an object / enemy move from left to right and right to left ?

hello programmers, this is my first post here. I am developing a 2d game which my opponent is the computer, and my problem is the movement of the opponent. The opponent must move from left to right then back from right to left automatically, but I cant do it, hope someone can help me here in my problem thanks a lot in advance

there are lots of way’s to do this and without knowing how your code is even setup I would say the easiest would simply be to just use transition.

ie: 

transition.to(opponentObject, {time = 1000, x = opponentObject.x - howmuchToMoveHim, onComplete = function() --do something after he finishes his move. end})

thank you very much Sir. Christoper Bishop, this is very helpful.

there are lots of way’s to do this and without knowing how your code is even setup I would say the easiest would simply be to just use transition.

ie: 

transition.to(opponentObject, {time = 1000, x = opponentObject.x - howmuchToMoveHim, onComplete = function() --do something after he finishes his move. end})

thank you very much Sir. Christoper Bishop, this is very helpful.