hook( id, table, func, arg, pattern )

instance function

Hook on to the chat input - when the player types something and presses enter to send the chat, your callback will be called provided the string entered is accepted by the pattern - you can then process the entered string.

Arguments

Name Type Description
id String Unique id for the hook
table Table The table the function is a part of
function Function The function to call on text entry
argument Any An argument to pass to the function
pattern String A Lua pattern to run on entered text

Returns

Type Description
Boolean True if the hook was added

Notes

The callback function should have the following signature - text is the string that the player entered, supplied by the TextInput library and hook is a TextInputHook object.

function ExampleTable:exampleFunction( text, hook )