mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-27 17:13:44 +01:00
add spartan readme
This commit is contained in:
parent
5c487bd11a
commit
c712bf662c
25
readme.md
Normal file
25
readme.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# api
|
||||||
|
|
||||||
|
note: supports all keys minetest does
|
||||||
|
|
||||||
|
```lua
|
||||||
|
controls.register_on_press(function(player, key)
|
||||||
|
-- called on key down
|
||||||
|
-- @player: player object
|
||||||
|
-- @key: key pressed
|
||||||
|
end)
|
||||||
|
|
||||||
|
controls.register_on_hold(function(player, key, length)
|
||||||
|
-- called while key is held
|
||||||
|
-- @player: player object
|
||||||
|
-- @key: key pressed
|
||||||
|
-- @length: length of time key was held in seconds
|
||||||
|
end)
|
||||||
|
|
||||||
|
controls.register_on_release(function(player, key, length)
|
||||||
|
-- called on key up
|
||||||
|
-- @player: player object
|
||||||
|
-- @key: key pressed
|
||||||
|
-- @length: length of time key was held in seconds
|
||||||
|
end)
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user