TreeItem.index readonly property

Get the index of the TreeItem. The index is an integer value representing the numerical position of the TreeItem among all others in the Tree, starting from 1.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("TreeItem.index sample", "fixed", 320, 250) local tree = ui.Tree(win, {["Tab 1"] = {"SubItem1", "SubItem2"}, "Tab 2", "Tab 3"}) win:status() tree:center() function tree:onSelect(item) win:status("TreeItem.index is "..item.index) end -- Launch Task to update user interface ui.run(win):wait()