Builtin Library
README.md
conflicts
Binding-conflict detection — reverse index over the Zin.actions /
Zin.axes registries. Two bindings "conflict" when they map to the same
canonical leaf key (e.g. both bind Space, or an action binds Space and
an axis's plus side is Space). Backs Zin.conflicts.
Rows carry a kind = "real" | "intentional" classification: two or
more action owners in the same context are real; action + axis
overlaps, cross-context actions, and explicitly marked pairs are
intentional. realOnly() is the noise-filtered view the Input tab
uses; forActiveProfile() is the full audit list.
Exports
Marking:
M.markIntentional(actionA: string, actionB: string) -> (boolean, string?)M.unmarkIntentional(actionA: string, actionB: string) -> booleanM.isIntentional(actionA: string, actionB: string) -> booleanM.listIntentional() -> { { string } }
Probing:
M.bindingKey(b: any) -> string?—"key:Space","modKey:Ctrl+KeyS","mouse:left", ornil.M.find(binding: any) -> { Owner }— owners that share any leaf key with the probe.M.forActiveProfile() -> { ConflictRow }— every shared-key row.M.realOnly() -> { ConflictRow }— subset wherekind == "real".
Internal (wired by zinput/init.luau):
M._setPersistFn(fn)— registers the save-back closure.M._loadIntentionalPairs(pairs_)— seed on profile activate.M._serializeIntentional() -> { { string } }— for profile save.M._resetIntentional()— test isolation.
Types:
Owner = { target: string, name: string, slot: any }—targetis"action"or"axis".ConflictRow = { key: string, owners: { Owner }, kind: string }—kindis"real"or"intentional".
Usage
local Zin = require("@builtin::modules.zinput")
-- Audit view (e.g. inside the Input tab):
for _, row in ipairs(Zin.conflicts.forActiveProfile()) do
print(row.key, row.kind, #row.owners)
end
-- Suppress an intentional same-context overlap:
Zin.conflicts.markIntentional("crouch", "slide")
Notes
modKeyleaf keys list modifiers alphabetically (Alt+Ctrl+Shift), soShift+Ctrl+KeySandCtrl+Shift+KeyScompare equal.- Continuous-source bindings (
mouseDelta,scroll,pointerLocked) never appear in conflict reports — two axes readingmouseDeltais by-design. - Persistence:
_setPersistFnis wired byzinput/init.luauso marks flow into the active profile JSON without conflicts needing a hard dep on profile. - The classifier counts every same-context action pair. If even one
pair is unmarked, the row is
"real"; otherwise"intentional".