-
Notifications
You must be signed in to change notification settings - Fork 148
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
Added 4 New Array Functions #131
Conversation
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
I love the included unit tests! |
I like @Killswitch00's names a lot more. They're very similar, to the point and short to type. |
is everything fine? |
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
my question is did i need a test function? or not |
_fn = "CBA_fnc_findTypOf"; | ||
LOG("Testing " + _fn); | ||
|
||
TEST_DEFINED("CBA_fnc_findTypOf",""); |
There was a problem hiding this comment.
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";
Improvements, fixes and tests for new array functions
|
||
TEST_DEFINED("CBA_fnc_findNil",""); | ||
|
||
// Use of embeded nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"embedded"
|
||
Parameters: | ||
0: Array | ||
1: TypeName, if parameter is a string, that contains a case insensitive typename, it will be used. Otherwies typename of the variable will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Otherwise"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
God dammit :D
More typo fixes
|
||
if (isNil "_typeName" || {_array isEqualTo []}) exitWith {-1}; | ||
|
||
// If a string is given, tansform to uppercase for type matching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"transform"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better word for "transform" in this context is to use "convert"
Add 4 New Array Functions to Find First Entry of TypeOf, TypeName, Null or Nil in Array