Introduction
Event-driven design offers a cheap and efficient way to detect user input without the need to check for input device status in each frame. A naïve approach to this is to query all input devices for changes in their state. There are many types of input devices such as keyboard, mouse, joystick, keypad controller, tablet, touch screen, and so on. LuaSDL relies on the library libSDL 1.2, which supports only basic input devices such as keyboard, mouse, and joystick. This version doesn't support the use of multiple devices of the same kind. This limitation has been removed with libSDL 2.x, which is used in LuaSDL 2. LuaSDL 2 is the successor of a former LuaSDL library and it's in the stage of early development at the time of writing. This chapter will cover the use of an older LuaSDL library, as the LuaSDL 2 interface is not so different.