Skip to content

system.playHaptic

since 1.1.0

Play haptic vibration.

system.playHaptic(duration[, strength])

Parameters

Name Type Required Description
duration string yes in ms (number) or pattern
strength number optional (default 0) % of the max strength, 0 stands for the strength entered in System

Returns

Nothing.

Examples

From the official Ethos documentation
system.playHaptic(200) -- Bzz during 200ms
system.playHaptic("- . -") -- Bzzz Bz Bzzz

Used in

Real-world usage

Called 4 times across 2 open-source Ethos Lua projects. A few short excerpts:
local function haptic()
  if system.playHaptic then system.playHaptic(". . . .") end
end

src/rfsuite/tasks/audio_events.lua:232

local function show(newText)
  if not newText or newText == "" then return end
  text = newText
  expiresAt = os.clock() + BANNER_SECONDS
  if system and system.playHaptic then system.playHaptic(". . . .") end
end

src/wfsuite/app/header.lua:174