Ah. I'll poke into this deeper later. Looking at your code and your answers above, here's another tip: if you want to reset or wipe
RaidSummonSyncDB such as you do on line 255, I instead suggest you use the
wipe() function. It is faster and more accurate than telling Lua to recreate the variable. This is because, using your method, Lua has to first look through the table
RaidSummonSyncDB, determine if there are values, nil them, then build the table all over again.
wipe() skips right to the nil step, and doesn't bother with steps 1 or 3 because it doesn't need to do those.
Code:
wipe(RaidSummonSyncDB)
Alternately you can use a
for loop rather than
wipe(). If
RaidSummonSyncDB contains lots and lots of data, using
for can be faster. I have heard
for is faster on small tables as well; your results may vary. Always test!
Code:
for i = 1, #RaidSummonSyncDB do
RaidSummonSyncDB[i] = nil
end
You still have access to
RaidSummonSyncDB later; it is empty, not deleted.
I am also curious about lines 219 - 230. Are you intentionally creating global variables? Do they need to be global? Can those be defined as local?