Skip to content

Added 4 New Array Functions#131

Merged
Killswitch00 merged 14 commits intoCBATeam:masterfrom
jokoho48:NewArrayFunctions
Sep 6, 2015
Merged

Added 4 New Array Functions#131
Killswitch00 merged 14 commits intoCBATeam:masterfrom
jokoho48:NewArrayFunctions

Conversation

@jokoho48
Copy link
Copy Markdown
Member

Add 4 New Array Functions to Find First Entry of TypeOf, TypeName, Null or Nil in Array

@ViperMaul ViperMaul added this to the 2.1 milestone Aug 25, 2015
@Killswitch00
Copy link
Copy Markdown
Contributor

Since the "find" script command finds the first array element or string-within-string, these function names could perhaps be shortened somewhat. Also, "empty" in BIS scripting parlance is "nil". How about calling them

  • CBA_fnc_findNil finds the first nil entry
  • CBA_fnc_findNull finds the first null entry
  • CBA_fnc_findType finds the first entry of a certain type.

I love the included unit tests!

@MikeMatrix
Copy link
Copy Markdown
Contributor

I like @Killswitch00's names a lot more. They're very similar, to the point and short to type.

@jokoho48
Copy link
Copy Markdown
Member Author

is everything fine?

@Killswitch00
Copy link
Copy Markdown
Contributor

The unit tests are missing and the added unit test file could be renamed to, say, "test_find.sqf".

add some error handling
add Test Script
@jokoho48 jokoho48 changed the title Add 3 New Array Functions Add 4 New Array Functions Aug 30, 2015
@jokoho48
Copy link
Copy Markdown
Member Author

my question is did i need a test function? or not

Comment thread addons/arrays/test_find.sqf Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that this unit test file hasn't been tested at all. Run it using

[] call compile preprocessFileLineNumbers "\x\cba\addons\arrays\test_find.sqf";

Comment thread addons/arrays/test_findNil.sqf Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"embedded"

Comment thread addons/arrays/fnc_findTypeName.sqf Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Otherwise"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God dammit :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants