Controls Library

Adds callbacks when a player press, hold or release a button.

API / Library

State: Draft
You should add at least one screenshot, but this isn't required.
This package can be submitted for approval when ready.

Syntax:

controls.register_on_press(function(player, key))

Description:
Register a callback to be called when a player press a key or mousebutton.

  • player - ObjectRef
  • key - string (can be "jump", "right", "left", "LMB", "RMB", "sneak", "aux1", "down" or "up")

Example:

controls.register_on_press(function(player, key)
        minetest.chat_send_all(player:get_player_name().." pressed the key "..key.."!")
end)

Reviews

Review

Do you recommend this mod?

Related