Assuming your
:get() and
:set() functions are working correctly, this is a simpler method.
Lua Code:
["onclick"]=function(self)
local newvalue=self.options[Wrap((tIndexOf(self.options,self:get()) or 0))+1,#self.options)];
self.valueText:SetText(newvalue);
self:set(newvalue);
end
Note: Both
tIndexOf() and
Wrap() are Blizzard-defined functions located in
SharedXML\TableUtil.lua and
SharedXML\MathUtil.lua respectively.