mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-24 07:33:43 +01:00
there is code in the readme too
This commit is contained in:
parent
776e527663
commit
a7783fdb9e
22
readme.md
22
readme.md
@ -14,22 +14,22 @@ Callbacks are supported for all keys in `player:get_player_control()`.
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
controls.register_on_press(function(player, key)
|
controls.register_on_press(function(player, key)
|
||||||
-- Called when a key is pressed
|
-- Called when a key is pressed
|
||||||
-- player: player object
|
-- player: player object
|
||||||
-- key: key pressed
|
-- key: key pressed
|
||||||
end)
|
end)
|
||||||
|
|
||||||
controls.register_on_hold(function(player, key, length)
|
controls.register_on_hold(function(player, key, length)
|
||||||
-- Called every globalstep while a key is held
|
-- Called every globalstep while a key is held
|
||||||
-- player: player object
|
-- player: player object
|
||||||
-- key: key pressed
|
-- key: key pressed
|
||||||
-- length: length of time key has been held in seconds
|
-- length: length of time key has been held in seconds
|
||||||
end)
|
end)
|
||||||
|
|
||||||
controls.register_on_release(function(player, key, length)
|
controls.register_on_release(function(player, key, length)
|
||||||
-- Called when a key is released
|
-- Called when a key is released
|
||||||
-- player: player object
|
-- player: player object
|
||||||
-- key: key pressed
|
-- key: key pressed
|
||||||
-- length: length of time key was held in seconds
|
-- length: length of time key was held in seconds
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user