take a look at my set swap addon; it has some features which can be used as learning examples for you. I write code in a pretty easy-to-follow way so I can more easily relearn it and maintain. See Options.lua file, mostly. In general, I find a good way to learn WoW's API and nuances is by reviewing other simple addons.
http://www.wowinterface.com/download...ftSetSwap.html