View Single Post
06-06-22, 05:09 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
Assuming your :get() and :set() functions are working correctly, this is a simpler method.
Lua Code:
  1. ["onclick"]=function(self)
  2.     local newvalue=self.options[Wrap((tIndexOf(self.options,self:get()) or 0))+1,#self.options)];
  3.     self.valueText:SetText(newvalue);
  4.     self:set(newvalue);
  5. end

Note: Both tIndexOf() and Wrap() are Blizzard-defined functions located in SharedXML\TableUtil.lua and SharedXML\MathUtil.lua respectively.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote