API:GetActionsForButtonCombination
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the ids of all actions bound to a given key or button combination.
actionIds = GetActionsForButtonCombination(deviceId, buttons)
Arguments
- deviceId
number– Input device, for exampleSystemData.InputDevice.KEYBOARD.- buttons
number-table– Array of button ids that make up the combination.
Returns
- actionIds
table– Array of action ids (number), indexed from 1. Empty if nothing is bound to the combination.
Details
- A binding matches when its device is
deviceId, it has exactly as many buttons asbuttons, and each of its buttons appears inbuttons. The order of the buttons does not matter. - Each action id appears at most once in the result.
- Use GetActionNameFromId to turn an id into a name.
- The stock UI never calls this function.
Errors
None.
Example
A minimal example built from the signature (42 and 29 are the left Shift and left Ctrl ids listed in easystem_utils/source/keyutils.lua):
local ids = GetActionsForButtonCombination( SystemData.InputDevice.KEYBOARD, { 42, 29 } )
for _, id in ipairs( ids ) do
local name = GetActionNameFromId( id )
end
