Skip to content

Commit

Permalink
go back to not needing 2 arguments for isbeing pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 28, 2018
1 parent 83f37ac commit 7330e13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local function searchInput(event)
searchstring = searchstring..HOOKS:GetClipboard()
else
--if not nil and (not a number or (ctrl pressed and not online))
local CtrlPressed = INPUTFILTER:IsBeingPressed("left ctrl", nil) or INPUTFILTER:IsBeingPressed("right ctrl", nil)
local CtrlPressed = INPUTFILTER:IsBeingPressed("left ctrl") or INPUTFILTER:IsBeingPressed("right ctrl")
if event.char and event.char:match("[%%%+%-%!%@%#%$%^%&%*%(%)%=%_%.%,%:%;%'%\"%>%<%?%/%~%|%w]") and (not tonumber(event.char) or CtrlPressed == (SCREENMAN:GetTopScreen():GetName() == "ScreenSelectMusic")) then
searchstring = searchstring..event.char
end
Expand Down
5 changes: 4 additions & 1 deletion src/InputFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,10 @@ class LunaInputFilter: public Luna<InputFilter>
return luaL_error(L, "IsBeingPressed(button, inputDevice=keyboard) expects at least one parameter");
}
DeviceButton button = StringToDeviceButton(SArg(1));
InputDevice device = lua_isnil(L, 2) ? DEVICE_KEYBOARD : StringToInputDevice(SArg(2));
InputDevice device = DEVICE_KEYBOARD;
if( !(lua_isnil(L, 2)) && lua_gettop(L) > 1) {
device = StringToInputDevice(SArg(2));
}
lua_pushboolean(L, INPUTFILTER->IsBeingPressed(DeviceInput(device, button)));
return 1;
}
Expand Down

0 comments on commit 7330e13

Please sign in to comment.