File docs/luadoc/goo.textinput.luadoc

A box you can input text to. Supports all characters, lowercase and uppercase. Multiline text and caret movement.

Functions

goo.textinput:getCaretPos () Get the position of the caret on the current line.
goo.textinput:getLinePos () Get the line number the caret is on.
goo.textinput:getMultiline () Get's if the textinput is in multiline mode
goo.textinput:getText () Get the text inside the textinput.
goo.textinput:insert (text, pos) Insert text on the current line at the specified position.
goo.textinput:newline (line_pos) Create a new line
goo.textinput:onKeyReturn () Callback function called when the return key is pressed
goo.textinput:onKeypressed (key, unicode) Callback function when the key is pressed.
goo.textinput:remove (pos, length) Remove text on the current line at the specified position.
goo.textinput:removeline (line_pos) Removes a line of text.
goo.textinput:setCaretPos (caretpos) Set the position of the caret on the current line
goo.textinput:setLinePos (linepos) Sets the line position of the caret
goo.textinput:setMultiline (multiline) Set the text input's multiline mode.
goo.textinput:setText (text) Sets the text of the box, new lines ignored if not multiline.


Functions

goo.textinput:getCaretPos ( )

Get the position of the caret on the current line.
The position is relative to the line it's on.

Return value:

number: the position of the caret, 1 is first character.

See also:

goo.textinput:getLinePos ( )

Get the line number the caret is on.

Return value:

number: the line the caret is on, 1 is first line.

See also:

goo.textinput:getMultiline ( )

Get's if the textinput is in multiline mode

goo.textinput:getText ( )

Get the text inside the textinput.

Return value:

string: the text.

goo.textinput:insert ( text, pos )

Insert text on the current line at the specified position.

Parameters

  • text :string
    the text to insert.
  • pos :number
    the position to insert it at.
goo.textinput:newline ( line_pos )

Create a new line

Parameters

  • line_pos :number
    the line number to add the newline after.
goo.textinput:onKeyReturn ( )

Callback function called when the return key is pressed

goo.textinput:onKeypressed ( key, unicode )

Callback function when the key is pressed.
this will not override the functionality of the text input,
if you wish to override keypresses use goo.textinput:keypressed() instead.

Parameters

  • key :string
    the keyConstant of the key pressed.
  • unicode :number
    the unicode value of the key pressed.
goo.textinput:remove ( pos, length )

Remove text on the current line at the specified position.

Parameters

  • pos :number
    the position to start removing.
  • length :number
    the number of character after pos to remove.
goo.textinput:removeline ( line_pos )

Removes a line of text.

Parameters

  • line_pos :number
    thr line number to remove.
goo.textinput:setCaretPos ( caretpos )

Set the position of the caret on the current line

Parameters

  • caretpos :number
    the position of the caret, 1 is first character

See also:

goo.textinput:setLinePos ( linepos )

Sets the line position of the caret

goo.textinput:setMultiline ( multiline )

Set the text input's multiline mode.

Parameters

  • multiline :bool
    true to allow multiple lines, false to not.
goo.textinput:setText ( text )

Sets the text of the box, new lines ignored if not multiline.

See also:

Valid XHTML 1.0!