View Single Post
04-06-20, 12:52 PM   #7
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Originally Posted by Fizzlemizz View Post
It doesn't check if the GMEXP_CFG exists so on a new install where the game has created the placeholder (GMEXP_CFG = nil) but you haven't assigned a table to it, this will fail.

Lua Code:
  1. if event == "PLAYER_LOGIN" then
  2.     if not GMEXP_CFG then
  3.         GMEXP_CFG = {}
  4.     end
  5.     -- etc.
  6. end
With your code, if a user sets a setting to nil it will be reset on next login which is probably not desired and depends on your configuration setup.
Ciao Fizzlemizz.

I am doing this in the first part of the addon ...

Lua Code:
  1. local ADDON, namespace = ...
  2. local L = namespace.L
  3.  
  4. GMEXP_NAMES = GMEXP_NAMES or {}
  5. GMEXP_CFG = GMEXP_CFG or {}
  6. -- go on

... because I didn't think I couldn't move them there
Now that I know I can I'll move them there.

Thanks so much Fizzlemizz.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote