Minty23185Fresh
August 1st, 2016, 17:34
I have defined four "constants" to be used throughout the lua script files in my extension. They're just names for numeric indicies into some tables. I defined them thus in one of the files:
CTEV_VSBL = 0;
CTEV_GM = 1;
CTEV_SELF = 2;
CTEV_TRGT = 3;
Within the file in which they're defined they work fine. In another file, the interpreter thinks they're nil. I get addition with nil or concatination with nil errors when they're used in the other file.
Example:
sDesc = sDesc .. " " .. goodFile.getTableString(CTEV_GM);
If I Debug.console( ) the CTEV_GM value in the offending script the value is reported as nil as is the value returned by the getTableString( ) function. So the concatenation throws an error.
I thought it might be a preparsing or load order issue with the files so I made sure the file with the "constants" is listed first in my extension.xml file. No help!
To ensure my code is functioning I localized the "constants" to both files, I just defined the "constants" in each file, thus:
local CTEV_VSBL = 0;
local CTEV_GM = 1;
local CTEV_SELF = 2;
local CTEV_TRGT = 3;
Then everything works fine!
Any ideas why my exposed CTEV_... variables are failing to act as global variables?
CTEV_VSBL = 0;
CTEV_GM = 1;
CTEV_SELF = 2;
CTEV_TRGT = 3;
Within the file in which they're defined they work fine. In another file, the interpreter thinks they're nil. I get addition with nil or concatination with nil errors when they're used in the other file.
Example:
sDesc = sDesc .. " " .. goodFile.getTableString(CTEV_GM);
If I Debug.console( ) the CTEV_GM value in the offending script the value is reported as nil as is the value returned by the getTableString( ) function. So the concatenation throws an error.
I thought it might be a preparsing or load order issue with the files so I made sure the file with the "constants" is listed first in my extension.xml file. No help!
To ensure my code is functioning I localized the "constants" to both files, I just defined the "constants" in each file, thus:
local CTEV_VSBL = 0;
local CTEV_GM = 1;
local CTEV_SELF = 2;
local CTEV_TRGT = 3;
Then everything works fine!
Any ideas why my exposed CTEV_... variables are failing to act as global variables?