• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM String index nonsense

X

Xenosis

Guest
I found out the reason some of my code wasn't working as expected because of string indexes starting at 1 and this hasn't been changed due to some legacy crap with Delphi🤦‍♂️
Good god YoYo Games get into the 21st century
We shouldn't have 0 index for most things and then this oddity where you enforce a different index rule elsewhere
You can do any index adjustments internally if you want but dont propagate this crap into the language
I appreciate this would cause breaking changes in some peoples code initially but its the right thing to do moving forward
 

rytan451

Member
It would cause breaking changes in nearly all code that works with strings. Since there are multiple professional developers using GMS2, causing their code to break would likely be a bad move from a business perspective from YoYo. However, to prevent this, it is possible to create a new set of string functions using zero-based indexing, and deprecate the old string functions.

As a programmer, you should be able to create these string functions yourself, as a wrapper around the already-existing string functions.
 
X

Xenosis

Guest
yes i agree deprecating but not removing the existing functions is the safest way forward as they are not going to cause breaking changes for this.
 

Yal

🐧 *penguin noises*
GMC Elder
Deprecating the entire string library feels a bit excessive... how about instead adding an option "use zero-indexed strings" that internally just adds 1 to the id when accessing strings, which would be unchecked for all legacy projects but default to 0 for all new projects?
 
Top