GetKeyBoundToFunction

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

<pageclass class="both" subcaption="Shared function"></pageclass> <lowercasetitle></lowercasetitle> getKeyBoundToFunction allows retrieval of the first key bound to a function.

Syntax

<section name="Server" class="server" show="true">
string getKeyBoundToFunction( player thePlayer, function theFunction )

Required ArgumentsRequired Arguments

  • thePlayer: The player you are checking the function bound to a key
  • theFunction: The function in which you would like to check the bound key

ReturnsReturns

Returns a string of the first key the function was bound to. </section>

<section name="Client" class="client" show="true">
string getKeyBoundToFunction( function theFunction )

Required ArgumentsRequired Arguments

  • theFunction: The function in which you would like to check the bound key

ReturnsReturns

Returns a string of the first key the function was bound to. </section>

Example

<section name="Client" class="client" show="true"> /key command gives bounded key to our chat function
function chat ()
  outputChatBox("Test")
end
bindKey("F2","down",chat)

function key()
  local boundKey = getKeyBoundToFunction(chat)
  outputChatBox(boundKey)
end
addCommandHandler("key",key)

This example written by Samurai </section>

See Also