(About SavedVariable) What would be the problem with this code?
Hi fellow forum users,
I was trying to create simple resource tracker addon using 'SavedVariables' and here's what I have done so far. Code:
local ResourceTrackFrame = CreateFrame("Frame"); According to wikia, it says that "Variables are saved and loaded in the global environment". Would that be something related to this since I declared frame and function as local? |
Did you list
## SavedVariables: Resource in your .toc file? The game will create Resource as the global to set your table to and save it when you logout. |
Quote:
|
If you have/want "PLAYER_LOGOUT" as the only registered event, get rid of
Code:
if event == "PLAYER_LOGOUT" then Otherwise change the function prototype to: Code:
local function ResourceTrackFrame_OnEvent(self, event, arg1) |
Quote:
Code:
local ResourceTrackFrame = CreateFrame("Frame"); |
Each parameter has to be getting what you expect. In this case, the event parameter was getting passed self (in this case the ResourceTrackFrame table) and the event landed in arg1.
Add "PLAYER_ENTERING_WORLD" to the registered events and Code:
local function ResourceTrackFrame_OnEvent(self, event, arg1) What you name the paramters doesn't matter, it is what they are passed that counts. Code:
local function ResourceTrackFrame_OnEvent(amanda, marge, sue) |
Quote:
I was so dumb D: Thank you for your correction :D |
All times are GMT -6. The time now is 05:03 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI