natiny.input.get_touch_at

Lua
natiny.input.get_touch_at(index) -> touch

Returns the stable touch identifier at an index in the current frame's touch list.

Parameters

Name Type Description
index number Zero-based index from 0 to natiny.input.get_touch_count() minus one

Returns

Type Description
number Touch identifier, or 0 when index is outside the current list

Example

Lua
for index = 0, natiny.input.get_touch_count() - 1 do
    local touch = natiny.input.get_touch_at(index)
    if natiny.input.get_touch_pressed(touch) then
        begin_drag(touch)
    end
end

Notes

  • Natiny tracks at most 24 touches. Additional touches are ignored until a slot becomes available.
  • Touch input is available on Android and in touch-enabled browsers. Other platforms report a touch count of 0.