Hello guys. Recently I've found out that strings in jass are limited to ~1k symbols in length and because of this I get some strange bugs
Here what I'm doing:
I have string (actually it is first array's element, doesnt really matter)
It works like "stack" simulation, don't bother much if you dont understand
Then this "stack" is filled with commands, one by one, each command ends with some separator, for example "&", each command is concatenated to previous string.
Format of command is
The important thing is that it is guaranteed that command is added to "stack" only if it is in the right format
So, after adding few commands to our "stack" (which is just simple string) it looks like
Now, I implemented function that allows me to remove last command from this "stack". Last means the rightest one in the string.
The algorithm is pretty simple:
I find the last entrance of symbol "-" (each command start exactly with "-add" and again you can consider it is strictly guaranteed)
and then reset string(our stack) to its Substring without symbols after last symbol "-" including it
Now, when our string is pretty short - it works fine.
When it becomes long - it doesnt work
Interesting thing is that as far as Im concerned Im able to add as many commands to the string as I want to, I can also see current string even if it is long and all is fine
But function that removes last command from the string stops working
What is the issue?
Here what I'm doing:
I have string (actually it is first array's element, doesnt really matter)
Code:
string commands = Commands_Stack[0]
It works like "stack" simulation, don't bother much if you dont understand
Then this "stack" is filled with commands, one by one, each command ends with some separator, for example "&", each command is concatenated to previous string.
Format of command is
Code:
"-add_DIRECTION_SLOT_TIME1_TIME2" (doesn't really matter)
The important thing is that it is guaranteed that command is added to "stack" only if it is in the right format
So, after adding few commands to our "stack" (which is just simple string) it looks like
Code:
"-add_right_5_1.23_3.45&-add_right_4_1.65_7.45&-add_down_5_1.23_3.45&-add_up_5_1.23_3.45&-add_right_5_1.23_3.45&" ... and so on
Now, I implemented function that allows me to remove last command from this "stack". Last means the rightest one in the string.
The algorithm is pretty simple:
I find the last entrance of symbol "-" (each command start exactly with "-add" and again you can consider it is strictly guaranteed)
and then reset string(our stack) to its Substring without symbols after last symbol "-" including it
Now, when our string is pretty short - it works fine.
When it becomes long - it doesnt work
Interesting thing is that as far as Im concerned Im able to add as many commands to the string as I want to, I can also see current string even if it is long and all is fine
But function that removes last command from the string stops working
What is the issue?