guiMemoGetCaretIndex | Multi Theft Auto: Wiki Skip to content

guiMemoGetCaretIndex

Client-side
Server-side
Shared

Pair: guiMemoSetCaretIndex

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 memo box.

OOP Syntax Help! I don't understand this!

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

Syntax

int guiMemoGetCaretIndex ( element theElement )
Required Arguments
  • theElement: The memo 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 memo to the chat

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

See Also

GUI Functions