Adds button press, hold and release events.
Go to file
2023-12-06 23:53:38 +11:00
.github/workflows add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
.luacheckrc General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +11:00
debug.lua General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +11:00
init.lua General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +11:00
license add biolerplate basic mod setup 2023-12-03 16:36:15 -05:00
mod.conf General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +11:00
readme.md General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +11:00
settingtypes.txt General cleanup and readme improvements (#7) 2023-12-06 23:53:38 +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)