Originally Posted by cokedrivers
... not sure why but the petstancebutton needs for i=1, NUM_SLOTS, 1 do which the other 2 do not ...
|
You don't. There is literally no difference whatsoever between "for i = 1, 10 do" and "for i = 1, 10, 1 do".
Also:
While it doesn't really matter, you should use variable names that make sense. A variable like "buttonName" should logically contain the
name of a button, not the button object itself.
Rather than doing more string concatenations and global lookups )eg. _["ThisBarButton"..i.."Icon"]) you should use the keys on the button that already point to those things (eg. button.icon).
Don't forget to call ClearAllPoints before you start calling SetPoint -- otherwise you may end up with unexpected results if the original region was positioned with points other than the ones you're setting.
Avoid duplicating code. If you're going to use the same chunk of code in 5 different places, factor it out into a function, and just call the function from those 5 places.
http://pastebin.com/WEGEz70y