View Single Post
11-17-16, 11:22 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I'd suggest looking at some documentation for the WoW API functions you are using. The Get/SetCVar functions can only be used to look up and set specific built-in game options. They have nothing to do with addon options or saving addon settings.

http://wow.gamepedia.com/API_SetCVar

It seems like your goal is to save addon settings, and be able to refer to them later. Assuming that's correct, you should look at tutorials related to that goal, like this one:

http://wow.gamepedia.com/Saving_vari..._game_sessions

I'd strongly advise against copying and pasting large chunks of code from other addons (eg. Mapster's options table) that you don't understand and trying to use that as a base for your own addon -- that's a recipe for frustration and not actually learning or accomplishing anything. I'd also advise against using large libraries (eg. AceConfig) until you have a better understanding of the underlying concepts (eg. writing to and reading variables in Lua in general, and saving variables between sessions in a WoW addon in particular). Start with something simpler, like saving one setting, and then work your way up to complex nested options if that's your end goal.

If you have no programming experience at all (which seems like the case since you're having trouble with writing/reading variables, which is a very basic programming concept) I'd suggest finding a beginner's tutorial. You may not be able to find one for Lua specifically, but any scripting language -- JavaScript or Python, for example, will both have lots of tutorials out there -- will give you a better foundation, so you'll at least be able to understand the terms used in API documentation, and have a better idea of what to ask for help with.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 11-17-16 at 11:25 PM.
  Reply With Quote