My table keeps getting overwritten with the default values because when I test to see if it's nil it returns true even though it's already created and saved.
I have ## SavedVariables: SDRC_DB
and heres the code
Lua Code:
local rName = GetRealmName()
local pName = UnitName("player")
SDRC_DB = SDRC_DB or {}
if SDRC_DB[rName] == nil then
print("realm name nil")
SDRC_DB[rName] = {
["Player1"] = {
["test"] = 0
}
}
end
if SDRC_DB[rName][pName] == nil then
print("realm name player nil")
SDRC_DB[rName][pName] = {
["world"] = false,
["threshold"] = 30000
}
end
I've also tried if not SDRC_DB[rName][pName] but it always returns nil
although my values are being overwritten in the lua, they are already created and saved correctly in the savedvariables file and are not the default values, so I'm somewhat confused.
Also, I don't know if my table setup is as condensed\optimized as it could be so any tips there would be great too