This is actually something I was wondering about when I made the XM
Now Playing module, and just couldn't bring myself to write TBTS on this.
In the XM module, I take the result of a MID function and pass it to
one of my own functions that in turn manipulates the results of the
MID and returns the result of THAT manipulation.
If I could abbreviate/abstract it, it might look something like this:
STRING_FUNCTION Fudge (STRING src$)
{
// Among other things, do something along these lines:
Garbage$ = REMOVE(";",src$);
// Blah blah, more code here...
RETURN (MyProcessedString$);
}
PUSH Go
{
tx$ = Fudge (MID(SomeExistingStringVar$,3,6));
}
My mindset was that the result of MID doesn't exist as a variable,
so I can't really mess around with the contents of that result like I
show in that snippet up there. So in the ACTUAL module, one of the
first things that happens inside Fudge is I copy "src$" into local
variable "temp$", then work on temp$ exclusively:
STRING_FUNCTION Fudge (STRING src$)
{
temp$ = src$;
// Among other things, do something along these lines:
Garbage$ = REMOVE(";",temp$);
// Blah blah, more code here...
RETURN (MyProcessedString$);
}
Does that make sense? Does anyone know for certain if what I did
was required, or does the result of MID (or any other string function
for that matter) exist in some malleable state that I can operate on?
Thanks,
- Chip
toggle quoted message
Show quoted text
--- In Crestron@..., "Oliver Hall" <oliver.hall@...> wrote:
This is where foo pipes up to say that Crestron's implementation of
ByRef does actually make a copy the data 8)