For an inventory system I'm working on I need to be able split strings. However I found the following:
(print: "1:2:3:4".split(":"))
Gives an "unexpected identifier" error. I noticed that the letters 'it' are a different colour so the problem could be that twine is mistaking them for the it keyword. A workaround is to add the following to the story's javascript:
String.prototype.spl = String.prototype.split;
Then the following works.
(print: "1:2:3:4".spl(":"))
One last wrinkle is the String.italics method works. So it seems to object to methods that contains 'it' anywhere other than the start.
Comments