Bale
Minion
I want to split a string into items. Pretty straightforward stuff. Then I run into the Ouija Board, Ouija Board. Still not hard, I easily split that string out with a little bit of negative lookbehind.
Then the string won't be turned into an item. It just won't. I can turn that string into an item normally, just not if I get it from split_string(). Witness the following test program!
It produces the following output:
WTF? Why can I transform the string into an item in the last line if it didn't work the first time?!
Here's a little sanity check in the CLI:
Then the string won't be turned into an item. It just won't. I can turn that string into an item normally, just not if I get it from split_string(). Witness the following test program!
Code:
string favgear = to_string($item[Meat Tenderizer is Murder]);
foreach it in $items[Ouija Board\, Ouija Board,Hand that Rocks the Ladle]
favgear += ","+replace_string(to_string(it), ",", "\\,");
print("String to split: "+ favgear);
print(" ");
foreach i,fav in split_string(favgear, "\\s*(?<!\\\\),\\s*") {
print(fav+" = "+ to_item(fav));
}
print(" ");
print("New test: Ouija Board\\, Ouija Board = " + to_item("Ouija Board\, Ouija Board"));
It produces the following output:
Code:
[COLOR="#808000"]> test[/COLOR]
String to split: Meat Tenderizer is Murder,Ouija Board\, Ouija Board,Hand that Rocks the Ladle
Meat Tenderizer is Murder = Meat Tenderizer is Murder
Ouija Board\, Ouija Board = none
Hand that Rocks the Ladle = Hand that Rocks the Ladle
New test: Ouija Board\, Ouija Board = Ouija Board, Ouija Board
WTF? Why can I transform the string into an item in the last line if it didn't work the first time?!
Here's a little sanity check in the CLI:
Code:
[COLOR="#808000"]> ashq print(to_item("Ouija Board\, Ouija Board"));[/COLOR]
Ouija Board, Ouija Board
Last edited: