guiGridListGetItemData | Multi Theft Auto: Wiki Skip to content

guiGridListGetItemData

Client-side
Server-side
Shared

Pair: guiGridListSetItemData

With this function you can retrieve the string data associated with an item in a grid list. This is not the text that is displayed on the item, but an internal string that you can use to hold extra information about the item.

Note

This function will only work after you set the item's text using guiGridListSetItemText.

OOP Syntax Help! I don't understand this!

Syntax

​mixed guiGridListGetItemData ( ​gui-gridlist gridList, ​int rowIndex, ​int columnIndex )
Required arguments
  • gridList: The grid list containing the item you're interested in.
  • rowIndex: The row index of the item. Indexes start at 0.
  • columnIndex: The column index of the item. Indexes start at 1.

Returns

Returns the item data of the specified item if succesful, false if one of the arguments was invalid or nil if data doesn't exists.

  • mixed: item data

Code Examples

client

This example displays a random item data from the gridlist.

function clientsideResourceStart()
local numberList = guiCreateGridList(0.80, 0.10, 0.15, 0.60, true)
local column = guiGridListAddColumn(numberList, "Column Title", 0.85)
if (column) then
local row = guiGridListAddRow(numberList)
local myItem = guiGridListSetItemText(numberList, row, column, tostring(math.random(0, 10) ^ 100), false, false)
local myItemData = guiGridListGetItemData(numberList, row, column) or "none"
outputChatBox("My gridlist item data: " .. myItemData) -- none
end
end
addEventHandler("onClientResourceStart", resourceRoot, clientsideResourceStart)

See Also

GUI Functions