lovr.textinput

Edit

This callback is called when text has been entered.

For example, when shift + 1 is pressed on an American keyboard, lovr.textinput will be called with !.

function lovr.textinput(text, code)
  -- your code here
end

Arguments

NameTypeDescription
textstring The UTF-8 encoded character.
codenumber The integer codepoint of the character.

Returns

Nothing

Notes

Some characters in UTF-8 unicode take multiple bytes to encode. Due to the way Lua works, the length of these strings will be bigger than 1 even though they are just a single character. The utf8 library included with LÖVR can be used to manipulate UTF-8 strings. Pass:text will also correctly handle UTF-8.

See also