Gamepad equivalent of keyboard_lastkey.
With thanks to Iván G. Lago for his suggestions.
How do I import gamepad_last into my game?
GameMaker Studio 2.2.3 allows you to import assets, including scripts and shaders, directly into your project via the "Local Package" system. From the Releases tab for this repo, download the .yymp file for the latest version. In the GMS2 IDE, load up your project and click on "Tools" on the main window toolbar. Select "Import Local Package" from the drop-down menu then import all scripts from the package.