i see something fishy
local var = mn.SEXPVariables['name']
if name is a string variable, then you dont need the quotes. using them essentially tries to find an object in the mn.SEXPVariables[] indexer with key 'name'. for example:
local name = "something"
local var = mn.SEXPVariables[name]
also this
type(var.Value)
will only return a string containing the value "number" or "string". the type() function is used to identify the datatype of a variable, not its contents.
also its good practice to call var:isValid() before doing anything with var. the correct way is:
local var = mn.SEXPVariables['name']
if (var:isValid() and cf.fileExists(filename,path_shipsave) and type(var.Value) == "number") then
var.Value = 1
else
var.Value = 0
end
but eliminating the obvious, im starting to think the enumeration system really needs an equality operator to be intuitive. expecting the scripter to convert the enumeration to string kinda goes against the reasoning for having an enumeration object to begin with (like if they were string constants instead).