GetKeyBoundToFunction: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:
Returns a string of the first key the function was bound to.
Returns a string of the first key the function was bound to.


==Example==  
==Example==
This page does not have an example.
<section name="Client" class="client" show="true">
/key command gives bounded key to our chat function
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--add an example here
function chat ()
outputChatBox("Test")
end
bindKey("F2","down",chat)
 
function key()
keyy = getKeyBoundToFunction(chat)
outputChatBox(keyy)
end
addCommandHandler("key",key)
</syntaxhighlight>
</syntaxhighlight>
This example written by '''Samurai'''
</section>


==See Also==
==See Also==
{{Input_functions}}
{{Input_functions}}
[[Category:Needs_Example]]
[[Category:Needs_Example]]

Revision as of 16:26, 20 February 2013

getKeyBoundToFunction allows retrieval of the first key bound to a function.

Syntax

string getKeyBoundToFunction( player thePlayer, function theFunction )

Required 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

Returns

Returns a string of the first key the function was bound to.

Example

Click to collapse [-]
Client

/key command gives bounded key to our chat function

function chat ()
outputChatBox("Test")
end
bindKey("F2","down",chat)

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

This example written by Samurai

See Also