Craig, Jacque, et al:
What I had not done was pass boardMix as a parameter to the function. Without seeing Craig's code I cannot be sure what I've found is the source of the "error"; but it demonstrates a possible answer: if boardMix is passed by value, its value in the SE will not change until the function ends.
Here's my code:
Code: Select all
global boardMix
function replaceIt theString
replace space with "." in theString
return theString
end replaceIt
function replaceIt2 @theString
replace space with "." in theString
return theString
end replaceIt2
on mouseUp
put field 2 into boardMix
put empty into field "New String"
put replaceIt(boardMix) into boardMix
put boardMix into field "New String"
put field 2 into boardMix
put empty into field "New String"
put replaceIt2(boardMix) into boardMix
put boardMix into field "New String"
end mouseUp
The SE shows boardMix changes immediately in replaceIt2, where it is passed by reference; but not until replaceIt (which is passed the string by value) is stepped out of.
Cheers!