Warning
Capture is still under development, major changes might occur.
Note
This implementation does not feature maids, all scriptevents are handled by a separate API - Event
Capture is a lightweight and easy to use UserInputService wrapper.
local Capture = require(...)
Capture.KeyName -> Key
Capture.A
Creates a new
Key
Key:Connect(f:()->any) -> Connection
Capture.A:Connect(function() print("Pressed A") end)
Creates and returns a new
Connection
forKey
Key:Bind(KeyName: string|Enum.KeyCode) -> Connection
Capture.A:Bind('F')
Capture.F:Connect(...)
Rebinds
Key
to a newKeyName
Connection:Disconnect() -> nil
local Connection = Capture.A:Connect(...)
Connection:Disconnect()
Disconnects the
Connection
Object forKey
Key:Destroy() -> nil
Capture.A:Connect(function() print("Pressed A") end):Destroy()
Destroys the
Key
Object and all it'sConnection
s
local Capture = require(...)
local APress = Capture.A:Connect(function()
warn('Pressed A')
end)
Capture.A:Bind('M')
Capture.W:Connect(function()
warn('Pressed W')
end)
Capture.D:Connect(function()
warn('Pressed D')
end)
APress:Disconnect()
warn(Capture.Keys)