im trying to save a single variable for my addon, and theres something wrong with my code, the variable doesnt exist everytime, is there something im missing
this is in my ToC file
Code:
## SavedVariablesPerCharacter: mLayouts
this is in my lua file
Code:
local frame = CreateFrame("FRAME", nil);
frame:RegisterEvent("ADDON_LOADED");
frame:RegisterEvent("PLAYER_LOGOUT");
local function loadvar(self, event, addon)
if addon == "testaddon" then
if mLayouts == nil then print("fail") end -- test function
tempmLayouts = mLayouts or {}
end
if event == "PLAYER_LOGOUT" then
mLayouts = tempmLayouts; -- We've met; commit it to memory.
end
end
frame:SetScript("OnEvent", loadvar);