guiEditGetMaxLength | Multi Theft Auto: Wiki Skip to content

guiEditGetMaxLength

Client-side
Server-side
Shared

Pair: guiEditSetMaxLength

Manual Review Required

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


This function returns the maximum text length that can be typed within an edit box.

OOP Syntax Help! I don't understand this!

  • Method: guiedit:getMaxLength(...)
  • Variable: .maxLength

Syntax

int guiEditGetMaxLength ( gui-edit guiEdit )
Required Arguments
  • guiEdit: The edit box you want to get the maximum text length of.

Returns

  • int: value

Returns the maximum text length on success, false otherwise.

Code Examples

shared

This example outputs the maximum text length of an edit field to the chat.

local edit = guiCreateEdit( 0.4, 0.4, 0.3, 0.1, "", true )
addEventHandler( "onClientGUIChanged", edit,
function( )
outputChatBox( "Characters remaining in edit box: " .. guiEditGetMaxLength( source ) - #guiGetText( source ) ) -- output remaining amount of characters
end
)

See Also

GUI Functions