Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new options to ArrayList FindString, FindValue #2216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Alienmario
Copy link
Contributor

@Alienmario Alienmario commented Nov 3, 2024

Adds new optional parameters to ArrayList find natives.

  • FindString: start index, reverse search, case sensitivity
  • FindValue: start index, reverse search
int found = 0; index = -1;
while ((index = list.FindString("str-val", TestStruct::strval, index)) != -1)
{
	found++;
}

The intention is to cover most general use cases of easily and efficiently iterating over ArrayLists (including enum struct ArrayLists).
The convention for the start index parameter matches that of FindEntityByClassname - startEnt. Its default of -1 allows starting from either side of the array, without manually passing the first index.
Test is included in PR, tested on linux, passed.

I am still learning, so excuse any newbie mistakes. I'm open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant