API:RemoveBinding
From RoR Wiki
UI Lua API · Bindings functions
Version: WAR 1.4.8
Removes one key or button binding from a keyboard action.
RemoveBinding(action, deviceId, buttons)
Arguments
- action
string– Name of the action.- deviceId
number– Input device of the binding to remove (aSystemData.InputDevicevalue).- buttons
number-table– Array of button IDs of the binding to remove, starting at index 1.
Returns
Nothing.
Details
- The binding is only removed when the action has a binding with exactly this device and these buttons, in the same order. Pass back the
deviceIdandbuttonsthat were read from the binding, as the stock UI does. - If
actionis not a known action, or no binding matches, nothing happens and no error is raised. - Entries equal to
65535(0xFFFF) inbuttonsare skipped. - When a binding is removed,
SystemData.Events.KEYBINDINGS_UPDATEDis raised. - The function needs at least three arguments and only reads the last three.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
Clearing the shown bindings of an action, from default/ea_keymappingwindow/source/keymappingwindow.lua:
for keyIndex=1, MAX_SHOWN_BINDINGS
do
local boundKeyData = KeyMappingWindow.actionsData[ actionIndex ]["keys"..keyIndex]
RemoveBinding( action, boundKeyData.deviceId, boundKeyData.buttons)
end
