View Single Post
04/03/14, 06:12 PM   #1
tiomun
 
tiomun's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 25
SavedVars and functions

Still very new to lua so its probably all me lol

I am having some issues dealing with ZO_SavedVars. for example, I constantly receive a stack traceback error on the line for event manager. I believe I have a issue with how I am recalling the values from ZO_SavedVars.

So far google has not been friendly to me with this project. I have a tough time telling the lua code apart from apy function events and w/e else there is in code samples I'm referencing from multiple addons. Any help/tips is apreciated

Lua Code:
  1. -- Default Saved Variables
  2. MMO.defaults = {
  3.     -- Bag
  4.     OverideBag = true,
  5.     -- Map
  6.     OverideMap = true,
  7.     -- ActionBar
  8.     OverideActionBar = true,
  9.     -- Mouse
  10.     OverideMouse = true
  11.    
  12. }
  13.  
  14. -- Hook initialization onto the EVENT_ADD_ON_LOADED listener
  15. EVENT_MANAGER:RegisterForEvent( "MMO" , EVENT_ADD_ON_LOADED , MMO.Initialize )
  16.  
  17. function MMO.Initialize( )
  18.  
  19.     -- Register the slash command handler
  20.     SLASH_COMMANDS[MMO.command] = MMO.Slash
  21.        
  22.     -- Load saved variables
  23.     MMO.Vars = ZO_SavedVars:New( 'MMO_VARS' , math.floor( MMO.version * 100 ) , nil , MMO.defaults )
  24.    
  25.     if (MMO.Vars.OverideBag == true) then  
  26.         MMO.bag()
  27.     end
  28.    
  29.     if (MMO.Vars.OverideActionBar == true) then
  30.         MMO.actionbar()
  31.     end
  32.    
  33. end

Last edited by tiomun : 04/03/14 at 08:33 PM. Reason: Found the highlight lua option :)
  Reply With Quote