guiEditGetCaretIndex | Multi Theft Auto: Wiki Skip to content

guiEditGetCaretIndex

Client-side
Server-side
Shared

Pair: guiEditSetCaretIndex

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the caret (the text cursor) position within the editbox.

OOP Syntax Help! I don't understand this!

  • Method: guiedit:getCaretIndex(...)
  • Variable: .caretIndex

Syntax

int guiEditGetCaretIndex ( element theElement )
Required Arguments
  • theElement: The edit box you want to get the caret position from

Returns

  • int: value

Returns the caret index on success, false otherwise.

Code Examples

shared

This example outputs the caret position of the edit field to the chat

local edit = guiCreateEdit(0.4,0.4,0.3,0.1,"",true)
addEventHandler("onClientGUIChanged",edit,function()
outputChatBox("Caret index is: "..guiEditGetCaretIndex(edit)) -- output index to chat
end)

See Also

GUI Functions