GetRowFromItemText

From Multi Theft Auto: Wiki
Jump to navigation Jump to search


This function enables you to get row from gridlist by using itemtext.

Syntax

int getRowFromItemText ( element gridList, string itemText [, int column] )

Required Arguments

  • gridList: The gridlist you want to get the row from.
  • itemText: The itemtext of the row.

Optional Arguments

  • column: The column you want to check the itemtext on.

Returns

Returns row if successful, false otherwise.

Code

Click to collapse [-]
Function source
function getRowFromItemText ( list, name, colum )
	if ( isElement(list) ) and ( getElementType(list) == "gui-gridlist" ) and ( type(name) == "string" ) then
		local colum = tonumber(colum) or 1
		local rows = guiGridListGetRowCount ( list ) - 1
		for i=0,rows do
			local text = guiGridListGetItemText ( list, i, colum )
			if ( text == name ) then
				return i
			end
		end
	end
	return false
end

Author: Bssol