• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

HTML5 string_pos_ext bugged for html

I can't find any posts about this, so I figured I'd post about it. I'm 90% sure string_pos_ext is bugged when targeting html. It seems to completely ignore the starting index parameter, and behave like string_pos instead. I made a simple bit of code in a draw gui event to demonstrate:

text = "Here is some text to show that string_pos_ext does not work in html.";

// find the first occurence of "i"
i_first = string_pos("i", text);

// find the second occurance of "i"
i_second = string_pos_ext("i", text, i_first);

draw_text(30, 30, text);
draw_text(30, 50, "The first 'i' is at " + string(i_first) + ", the second is at " + string(i_second));
If you run this in windows, it'll output 6 and 35. In HTML it'll output 6 both times. I was going to file a bug report, but figured I'd confirm it here first. I'm running 2.3 btw. Anyone else get the same behavior?


Friendly Tyrant
Forum Staff
I think you'd be best filing a bug report, tbh... I can't see anything obviously wrong with the code...


šŸ§ *penguin noises*
GMC Elder
Does your code work as intended if you resume searching at i_first + 1 instead of at i_first?

Also, I can't find string_pos_ext in the online manual, are you using some sort of script? Have you verified that it works properly?
Just filed a report. Luckily it's not too hard to make a script that does the same thing. But it'll be nice when the "real" version works correctly.


Friendly Tyrant
Forum Staff
Ah, I see... docs2 still is the first google hit and I didn't realize it was the outdated 2.2 manual. Not sure if that's intentional (backwards compatibility etc) or a problem.
It's intentional for the moment but both Docs2 and Docs (1.4) will be redirecting to "manual" sometime in the future once everything has settled down (possibly with the 2.3.1 update, possibly before).
  • Like
Reactions: Yal
Yoyo responded. It's definitely a bug. They said they've filed it in their internal bug database and they'll make a note of it in the release notes when it gets fixed.