Answered: tween Syntax: Whats wrong?

The line below shows an editor error saying “} exepected near =”. Why does this produce an error? I assume its referring to the equals sign in the target table.

tween(2,self.pillars[i],{pos.x = moveDist},tween.easing.quadInOut,func)

The target can’t be foo.bar it has to just be bar. So this should work:

tween(2,self.pillars[i].pos,{x = moveDist},tween.easing.quadInOut,func)

Also, is func at the end the name of a callback function?

@yojimbo2000 :open_mouth: Stop the presses.

 classInstance.variableName

That gets you a variable data for a class instance? I’ve been writing “GetX” functions for nothing?! Yes, func is a call back function.
That works, thanks!

Assuming pos is a vec2, I think you can also tween an entire vec2, eg:
tween(2,self.pillars[i],{pos = newPos},tween.easing.quadInOut,func)

Yes you can access variables with the dot notation and methods with the colon. Eg:

MyClass = class()

function MyClass:myMethod()
   self.someVariable = 3
end

anInstance = MyClass()
--access the methods and variables of this instance:
anInstance:myMethod()
print (anInstance.someVariable)

@yojimbo2000 Thanks.