Give splittext a string that would be split into three elements, but the function now does only return two.
Numbered Steps to Reproduce Problem:
1. Give splittext a string and delimiter
2. Determine how many elements you expect
3. Get one less
Code Snippet (if applicable) to Reproduce Problem:
// Substitutional function to temporarily fix the issue
/proc/split_text(var/string,var/delimiter,var/start=1,var/end=0,include_delimiters=0)
var/list/result = list()
var/previous = start
var/position = start
while(position = findtext(string, delimiter, previous))
result.Add(copytext(string, previous, position + include_delimiters ? 1 : 0))
previous = position + 1
result.Add(copytext(string, previous))
return result
world/New()
var/str = "blah,hah,heh,hoh"
var/delimit = ","
world.log << "splittext"
for (var/v in splittext(str, delimit))
world.log << v
world.log << "split_text"
for (var/v in split_text(str, delimit))
world.log << v
Expected Results:
blah
hah
heh
hoh
Actual Results:
blah
hah
heh
Does the problem occur:
Every time? Or how often?
Affects all projects I've touched with 513
In other games?
Yes
In other user accounts?
N/A
On other computers?
Unknown
When does the problem NOT occur?
By not using 513
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Anything earlier than 513 so far
Workarounds:
Using the split_text function as provided
// Substitutional function to temporarily fix the issue
/proc/split_text(var/string,var/delimiter,var/start=1,var/end=0,include_delimiters=0)
var/list/result = list()
var/previous = start
var/position = start
while(position = findtext(string, delimiter, previous))
result.Add(copytext(string, previous, position + include_delimiters ? 1 : 0))
previous = position + 1
result.Add(copytext(string, previous))
return result
One important reason I ask this is because I want to know if the behavior changed between 513.1492 and 513.1493.