All posts
·Rebind

Luau Scripting with Hardware Output

Rebind scripts are written in Luau, a typed, fast variant of Lua, and run in the Rebind Engine on your PC. What the language brings and what the SDK exposes.

rebind lualua macrorebind scriptluaurebind device

Rebind scripts are written in Luau and run in the Rebind Engine on your PC. The engine handles capture, timing, and output; with Rebind Link attached, that output leaves the device as USB HID at a USB report rate of up to 8,000 Hz. If you know Lua, or Roblox's scripting environment where Luau originated, the language will feel familiar immediately. If not, it is a small, clean scripting language, considerably more capable than the macro editors built into vendor software.

This article covers what Luau is, why it fits input scripting, and what the Rebind SDK exposes.

What is Luau?

Luau is a typed variant of Lua developed by Roblox; the getting started guide introduces it. In Rebind, Luau runs inside a native runtime that owns the low-level timing loop, device communication, and window awareness. You write logic. The engine handles the plumbing.

The properties that matter for input scripting:

  • Real control flow. if, for, while, repeat, functions, closures. Not a sequence recorder.
  • Coroutines. You can write asynchronous sequences (wait for a condition, yield mid-script, resume) without callbacks or complex state machines.
  • State management. Variables persist across events. You can build counters, toggle states, track sequences across multiple inputs.
  • Standard library. String manipulation, math, table operations, and the Rebind SDK functions.

The scripting model

Every Rebind script responds to input events. When you press a key or move a mouse, the engine fires your script with the event details. Your script can:

  • Pass the event through unchanged: it reaches the OS as normal
  • Block the event: the input is consumed, nothing reaches the OS
  • Transform it: intercept a right click, emit a different key combination instead
  • Generate new events: trigger mouse movements, keystrokes, or sequences that weren't in the original input

Your script decides what an input means. The firmware still sends keystrokes, but deciding what they mean is no longer its department.

Coroutines for sequences

A macro that fires a timed sequence looks like this in most tools: a flat list of steps with hardcoded delays. In Luau you write it as a coroutine:

-- press a key, wait, press another, wait, release both
local function combo()
  HID.Down("LShift")
  Sleep(15)
  HID.Down("A")
  Sleep(20)
  HID.Up("A")
  HID.Up("LShift")
end

The Sleep calls yield the coroutine without blocking the input processing loop. Other events continue to be handled while the sequence is in progress, so multi-step automations don't stall the engine.

Per-application context

Scripts can read what's happening on the host. The SDK includes window focus awareness, so the same key can do different things depending on which application is active:

if System.Window().process == "Photoshop" then
  -- remap ctrl+z differently
end

What the SDK exposes

What Rebind can do walks through every capability area, from remapping and text expansion to HTTP and shared memory IPC; the Documentation covers the full API.

Who this is for

If you've been using AutoHotkey, the event model will be familiar and the typed language catches more mistakes before they run. If you're coming from vendor software, Luau expresses conditions and state that no profile editor can. If you're starting from scratch, the curve is shallow. Luau is a small language and the SDK is consistent.

The Documentation covers the full API with examples. The in-app marketplace has ready-made scripts if you want to start without writing code. Download free and press a key.

All posts