Input lock (tm.inputlock)
Client side only. A lock held while an in-world editor (zone creator, world tools, gizmo) owns the keyboard.
DisableAllControlActions only blocks the game's own controls. Key mappings (inventory, radial menu, emotes) fire from the raw key, so an editor that reads those keys would also trigger them. While any lock is held, the keybind layer should ignore presses (releases still run, so a held key never sticks). A keybind that must keep working inside an editor opts out on its own side.
local release = tm.inputlock.acquire()
-- editor loop
release()
-- or, around a function that yields:
local result = tm.inputlock.run(function() return editor() end)tm.inputLock is registered as an alias of tm.inputlock once the import has loaded. Import by the lowercase name (tm.inputlock), which is the folder name the loader looks up.
Functions
| Call | Description |
|---|---|
tm.inputlock.acquire() | Takes a lock and returns a release function. Calling release more than once is safe. |
tm.inputlock.run(fn, ...) | Calls fn(...) with a lock held and returns its results. The lock is released even when fn errors, and the error is re-raised. |
tm.inputlock.isLocked() | true while any resource holds a lock. |
Shared state
The lock count lives on LocalPlayer.state.tmEditorActive (not replicated), so every resource sees it. A keybind layer reads that key (or calls tm.inputlock.isLocked()) and ignores presses while it is above zero.
Cleanup
Locks a resource took and has not released are released when that resource stops, so an editor that dies mid-edit cannot leave the keyboard locked. Locks held by other resources are not touched.