Code: Select all
// Variable declared implicitly as an integer because we assigned 0 to it
var something := 0;
// Placed a string in a variable originally assigned an integer value
something := "a string of characters";
So the following produced a "Property not found" in the CProp preceeding the added members:
Code: Select all
program setdest(object)
// Variable declared but no type or value assigned
var dest;
dest.+x := 1000;
dest.+y := 1000;
dest.+z := 10;
dest.+realm := "britannia";
SetObjProperty(object, Destination", dest);
The proper way is:
Code: Select all
program setdest(object)
// Variable expressly declared as a struct
var dest := struct;
dest.+x := 1000;
dest.+y := 1000;
dest.+z := 10;
dest.+realm := "britannia";
SetObjProperty(object, Destination", dest);
I don't know if this is a bug. I come from a pretty strongly "typed" programming language, Pascal, so I approve of this requirement but the compiler is the place to trap this normally and I only wish it was required on all variables that their type was to be declared and rigidly enforced. I should note that eCompile didn't complain about this. It was at runtime that the behaviour surfaced. So just be aware of this when writing your programs (scripts).