Touch

The Touch is a table which includes the current touches' attributes.

Attributes
We assume that we have the function touched ( touch ).

touch.id (integer)
The Touch ID (note: this is not the fingerprint), which is unique every time you start touching the screen. When you move your finger, the Touch ID stays, which makes it good for tracking a touch.

touch.pos (vec2)
Returns the current position of the touch.

touch.prevPos (vec2)
Returns the position from the previous frame of the touch.

touch.type
touch.type can be either DIRECT, INDIRECT or STYLUS

touch.state
touch.state can be either BEGAN, MOVING, ENDED or CANCELLED. The touch state is BEGAN, when it has been created, MOVING, when the finger has not lifted of, but the touch state changed, and ENDED, when the touch was lifted. CANCELLED occurs as an error when the touch has been not willingly ended.