I'd like to have a ModScript "string" constructor that will handle a VBScript String like this:
var str_PostData1 = string(Shell.PostData());
For the time being I'm doing this, but I'd like to learn how to do write my own constructors. ModScript needs a lot of 'em.
var str_PostData1 = string(Shell.PostData().to_string());
Below is my overloaded constructor function. The runtime error is:
Line 395> this=v.to_string();
Error: "Error, cannot assign to temporary value."
def string::string(Variant v) {
// If the Chai type is ModScript "Variant" type, i.e. a VBScript type object
// AND the VBScript type is a string, initialize string to that string,
// OTHERWISE initialize it to a blank string.
if (v.type_name() == "Variant" && VarType(v)==vbString) {
this=v.to_string();
} else {
this="";
}
return this; // Do I need this???
}