That FN Ninja
Member
Okay, I've been searching for some instruction on the replace_string function and haven't got it figured out yet. I found this:
That's very helpful, but I guess I not sure how to use buffers. When replace_string, or any function for that matter, makes a buffer how do you call that buffer in a script?
As an example how can I change teststring "xyz" to string "123"?
This:
as expected returns this:
I don't know how to pass the buffer from the first replace_string to the second replace_string?
from here http://kolmafia.us/showthread.php?t=2226ASH strings are immutable; it's not possible for replace_string() to modify the string in place... Instead, it returns a buffer containing the modified text (and as a buffer, it's more suitable for any further modifications you want to make to the text).
That's very helpful, but I guess I not sure how to use buffers. When replace_string, or any function for that matter, makes a buffer how do you call that buffer in a script?
As an example how can I change teststring "xyz" to string "123"?
This:
Code:
string teststring = "xyz";
print(teststring);
print(replace_string(teststring,"x","1"));
print(replace_string(teststring,"y","2"));
Code:
xyz
1yz
x2z
I don't know how to pass the buffer from the first replace_string to the second replace_string?