Here is another way to do it: function getHilightedValue pTreeWidgetReference local tElement, tArray put the arrayData of pTreeWidgetReference into tArray put the hilitedElement of pTreeWidgetReference into tElement split tElement by comma return tArray[tElement] end getHilightedValue