So I'm modifying QDKP2 for my guilds needs, I've mentioned that in several posts.
There's a saved var, QDKP2_Data that contains a metric you-know-what ton of table data. There's a function that takes QDKP2_Data[PlayerGuild] and assigns it to GuildData. It then takes GuildData and does all sorts of stuff like this:
Code:
GuildData = QDKP2_Data[PlayerGuild]
.
.
.
GuildData.raid = GuildData.raid or {}
GuildData.raidOffline = GuildData.raidOffline or {}
GuildData.standby = GuildData.standby or {}
GuildData.raidRemoved = GuildData.raidRemoved or {}
GuildData.TimerBase = GuildData.TimerBase or {}
.
.
.
QDKP2raid = GuildData.raid
QDKP2raidOffline = GuildData.raidOffline
QDKP2standby = GuildData.standby
QDKP2raidRemoved = GuildData.raidRemoved
QDKP2timerBase = GuildData.TimerBase
Now, since QDKP2_Data is a table, GuildData is mearly a pointer to that table, and subsequently the QDKP2 variables are pointers to a pointer. (I didn't think Lua did it like that, but after some reading found I was wrong. And here I thought Lua didn't have pointers like C)
I added in some tables following the same format and they persist between game sessions and /reload.
My problem comes in when I try to add a non-table variable:
Code:
GuildData.GuildHours = GuildData.GuildHours or 0
.
.
QDKP2GuildHours = GuildData.GuildHours
The GuildHour data always gets reset to 0, and I'm not sure why. The 0 would be under, effectively, QDKP2_Data[PlayerGuild]["GuildHours"] which is a table, right? Which QDKP2GuildHours should just point to? Or am I thinking this through wrong and just need to be a better debugger? (I believe I'm not resetting QDKP2GuildHours to 0 in my code though)