natiny.input.get_touch_count

Lua
natiny.input.get_touch_count() -> count

Returns the number of touch identifiers available in the current frame. The count includes touches released during this frame.

Returns

Type Description
number Number of available touch identifiers, from 0 to 24

Example

Lua
for i = 0, natiny.input.get_touch_count() - 1 do
    local touch = natiny.input.get_touch_at(i)
    natiny.render.circle(natiny.input.get_touch_x(touch),
                         natiny.input.get_touch_y(touch), 24)
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 return 0.