Why does ESO tell me I am attempting to index a nil value when I am declaring a constant? Here is a
screen shot. Line 275 is a "}" closing or end brace.
Lua Code:
## Title: Cosechador
## Author: Sharlikran
## Version: 0.1.0
## APIVersion: 100003
## SavedVariables: Cosechador_SavedVariables
Libs/LibAddonMenu-1.0/LibStub/LibStub.lua
Libs/LibAddonMenu-1.0/LibAddonMenu-1.0/LibAddonMenu-1.0.lua
Localization/CosechadorLoc.lua
## Localization/CosechadorNodesLoc.lua
## Localization/CosechadorMapNames.lua
## Localization/CosechadorData-de.lua
## Localization/CosechadorData-en.lua
## Localization/CosechadorData-fr.lua
Cosechador.lua
CosechadorConstants.lua
Cosechador.xml
Main File is Cosechador.lua and in it I have a COS = {}. The main part of the mod works fine. It is a lite version of Esohead with only Harvest, Fishing, Provisioning, and Chests. It works fine, saves the data, everything is perfect. Then I try to add, with permission, code from HarvestMap and Undiscovered for localization of the Map Names. I am going to import and export data to and from both Esohead and HarvestMap.
I copy the same exact file I am using, without error from HarvestMap to my Mod Cosechador and name it CosechadorLoc.lua. The only thing I changed in it was the prefix.
So I changed this:
Lua Code:
Harvest.allLocalizations = {
["en"] = {
<<<< Stuff In here >>>
},
["de"] = {
<<<< Stuff In here >>>
},
["fr"] = { --translation by wookiefrag
<<<< Stuff In here >>>
}
}
Harvest.language = (GetCVar("language.2") or "en")
Harvest.localization = Harvest.allLocalizations[Harvest.language]
To This:
Lua Code:
COS.allLocalizations = {
["en"] = {
<<<< Stuff In here >>>
},
["de"] = {
<<<< Stuff In here >>>
},
["fr"] = { --translation by wookiefrag
<<<< Stuff In here >>>
}
}
COS.language = (GetCVar("language.2") or "en")
COS.localization = COS.allLocalizations[COS.language]
Then I get that error.
I didn't have it in an Init function so I added it and that didn't eliminate the error.
Lua Code:
function COS.Initialize()
-- Set Localization
COS.MapNameData = {}
COS.localization = {}
COS.allLocalizations = {}
COS.savedVars = {}
COS.debugDefault = 0
COS.dataDefault = {
data = {}
}
COS.name = ""
COS.time = 0
COS.isHarvesting = false
COS.action = ""
end
I do not have to add COS.allLocalizations = {} or COS.localization = {} to HarvestMap as Harvest.{{array}} = {}. What is also weird is, as you will notice, I have some of the commented out in the Cosechador.txt file for testing. All I did was copy the same localization folder from HarvestMap to my mod and change the prefix. All 6 files work with HarvestMap without throwing that error.
In one of the other files named CosechadorData-de.lua it errors on this line
Lua Code:
if COS.MapNameData == nil then COS.MapNameData = {} end
In HarvestMap I have that same line like this, and it does not error.
Lua Code:
if Harvest.MapNameData == nil then Harvest.MapNameData = {} end