Adds button press, hold and release events.
Go to file
2023-12-04 19:35:24 +11:00
.github/workflows add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
.luacheckrc clean up after wsor 2023-12-04 19:00:10 +11:00
debug.lua tabs not spaces 2023-12-04 19:23:45 +11:00
init.lua tabs not spaces 2023-12-04 19:23:45 +11:00
license add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
mod.conf clean up after wsor 2023-12-04 19:00:10 +11:00
readme.md there is code in the readme too 2023-12-04 19:35:24 +11:00
settingtypes.txt clean up after wsor 2023-12-04 19:00:10 +11:00

Controls [controls]

luacheck ContentDB

Utility library for control press/hold/release events.

Rewritten and maintained version of Arcelmi/minetest-controls.

API

Callbacks are supported for all keys in player:get_player_control().

controls.register_on_press(function(player, key)
	-- Called when a key is pressed
	-- player: player object
	-- key: key pressed
end)

controls.register_on_hold(function(player, key, length)
	-- Called every globalstep while a key is held
	-- player: player object
	-- key: key pressed
	-- length: length of time key has been held in seconds
end)

controls.register_on_release(function(player, key, length)
	-- Called when a key is released
	-- player: player object
	-- key: key pressed
	-- length: length of time key was held in seconds
end)