You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like `_difference()`, except that it accepts iteratee which is invoked for each element of each array to generate the criterion by which they are compared.
236
+
237
+
```gml
238
+
@param {Array} array The array to inspect
239
+
@param {Array} arrays... The arrays whose values are to be excluded
240
+
@param {Script} iteratee The script invoked on each element to generate comparison criteria
241
+
242
+
@returns {Array} The difference between the first and the remaining arrays
243
+
244
+
@example
245
+
// _floor(x)
246
+
return floor(x);
247
+
248
+
var arr0 = [0.5, 1, 2];
249
+
var arr1 = [0];
250
+
var arr2 = [0.1, 2.9];
251
+
_difference_by(arr0, arr1, arr2, _floor);
252
+
// => [1];
253
+
```
254
+
255
+
### `_difference(array, arrays...)`
256
+
257
+
Creates an array of values from the first array not found in the other arrays.
258
+
259
+
```gml
260
+
@param {Array} array The array to inspect
261
+
@param {Array} arrays... The arrays whose values are to be excluded
262
+
263
+
@returns {Array} The difference between the first and the remaining arrays
264
+
265
+
@example
266
+
var arr0 = [0, 1, 2];
267
+
var arr1 = [0];
268
+
var arr2 = [0, 2];
269
+
_difference(arr0, arr1, arr2);
270
+
// => [1];
271
+
```
272
+
273
+
### `_drop_right(array, n)`
274
+
275
+
Creates a slice of array with n elements dropped from the end.
276
+
277
+
```gml
278
+
@param {Array} array The array to inspect
279
+
@param {Integer} n The number of elements to drop
280
+
281
+
@returns {Array} The slice of array
282
+
283
+
@example
284
+
var arr = [0, 1, 2, 3];
285
+
_drop_right(arr, 2);
286
+
// => [0, 1];
287
+
```
288
+
289
+
### `_drop(array, n)`
290
+
291
+
Creates a slice of array with n elements dropped from the beginning.
292
+
293
+
```gml
294
+
@param {Array} array The array to inspect
295
+
@param {Integer} n The number of elements to drop
296
+
297
+
@returns {Array} The slice of array
298
+
299
+
@example
300
+
var arr = [0, 1, 2, 3];
301
+
_drop(arr, 2);
302
+
// => [2, 3];
303
+
```
304
+
182
305
### `_error(message [, fatal])`
183
306
184
307
When running with the debugger, displays an error window. Otherwise, logs an error using `_log`.
@@ -195,6 +318,30 @@ _error("This is an error that will let the game continue", false);
195
318
_error("This is an error that will kill the game", true);
196
319
```
197
320
321
+
### `_fill(array, value [, start, end])`
322
+
323
+
Fills elements of array with value from start up to, but not including, end.
324
+
325
+
> *Note*: This method mutates array.
326
+
327
+
```gml
328
+
@param {Array} array The array to fill
329
+
@param {*} value The value with which to fill elements of array
330
+
@param {Integer} optionalStart The start index
331
+
@param {Integer} optionalEnd The end index
332
+
333
+
@returns {Array} The filled array
334
+
335
+
@example
336
+
var arr = [0, 1, 2, 3];
337
+
_fill(arr, 4, 1, 3);
338
+
// => [0, 4, 4, 3];
339
+
340
+
var arr = [0, 1, 2, 3];
341
+
_fill(arr, 0);
342
+
// => [0, 0, 0, 0];
343
+
```
344
+
198
345
### `_filter(collection, script)`
199
346
200
347
Returns a collection where values of the input collection are truthy when run through the provided function.
@@ -271,6 +418,47 @@ Returns the index of the given item in the given array, or -1
271
418
272
419
```
273
420
421
+
### `_intersection_by(arrays..., iteratee)`
422
+
423
+
Like `_intersection()`, except that it accepts iteratee which is invoked for each element of each array to generate the criterion by which uniqueness is computed.
424
+
425
+
```gml
426
+
@param {Array} arrays... The arrays to be intersected
427
+
@param {Script} iteratee The script invoked on each element to generate uniqueness criteria
428
+
429
+
@returns {Array} The intersection of the given arrays
430
+
431
+
@example
432
+
// _floor(x)
433
+
return floor(x);
434
+
435
+
var arr0 = [0, 1.9];
436
+
var arr1 = [0.6, 3];
437
+
_intersection_by(arr0, arr1, _floor);
438
+
// => [0];
439
+
```
440
+
441
+
### `_intersection(arrays...)`
442
+
443
+
Creates an array of unique values common to all given arrays in the order in which they originally appeared.
444
+
445
+
```gml
446
+
@param {Array} arrays... The arrays to be intersected
447
+
448
+
@returns {Array} The intersection of the given arrays
449
+
450
+
@example
451
+
var arr0 = [0, 1];
452
+
var arr1 = [0];
453
+
_intersection(arr0, arr1);
454
+
// => [0];
455
+
456
+
var arr0 = ['Sword', 'Potion'];
457
+
var arr1 = ['Shield', 'Potion', 'Sword'];
458
+
_intersection(arr0, arr1);
459
+
// => ['Sword', 'Potion'];
460
+
```
461
+
274
462
### `_is_equal(valueA, valueB [, dsType])`
275
463
276
464
Checks if two values are equal, being safe about type and checking first-level children of ds_lists and ds_maps. Returns false on type inequality rather than throwing an error.
@@ -525,17 +713,19 @@ _reduce(arr, concat);
525
713
526
714
### `_reverse(array)`
527
715
528
-
Reverses a given input array
716
+
Reverses the order of elements in array.
717
+
718
+
> *Note*: This method mutates the input array. To create a new array instead, use `_backward`
Like `_union()`, except that it accepts iteratee which is invoked for each element of each array to generate the criterion by which uniqueness is computed.
902
+
903
+
```gml
904
+
@param {Array} arrays... The arrays to be unioned
905
+
@param {Script} iteratee The script invoked on each element to generate uniqueness criteria
906
+
907
+
@returns {Array} The union of the given arrays
908
+
909
+
@example
910
+
// _floor(x)
911
+
return floor(x);
912
+
913
+
var arr0 = [0.5, 1.2];
914
+
var arr1 = [0, 1.9];
915
+
_union_by(arr0, arr1, _floor);
916
+
// => [0.5, 1.2];
917
+
```
918
+
919
+
### `_union(arrays...)`
920
+
921
+
Creates an array of unique values, in the order in which they originally appeared, from all given arrays.
922
+
923
+
```gml
924
+
@param {Array} arrays... The arrays to be unioned
925
+
926
+
@returns {Array} The union of the given arrays
927
+
928
+
@example
929
+
var arr0 = _array_of(0, 1);
930
+
var arr1 = _array_of(0);
931
+
_union(arr0, arr1);
932
+
// => [0, 1];
933
+
934
+
var arr0 = _array_of('Sword', 'Potion');
935
+
var arr1 = _array_of('Shield', 'Sword');
936
+
_union(arr0, arr1);
937
+
// => ['Sword', 'Potion', 'Shield'];
938
+
```
939
+
709
940
### `_uniq(array)`
710
941
711
942
Returns an array with all duplicate values removed
@@ -719,3 +950,59 @@ Returns an array with all duplicate values removed
719
950
_uniq([1, 1, 2, 3]);
720
951
// => [1, 2, 3]
721
952
```
953
+
954
+
### `_unzip(array)`
955
+
956
+
From a zipped two-dimensional array, creates a collection of grouped elements by regrouping the elements to their pre-zipped configuration
957
+
958
+
```gml
959
+
@param {Array} array The zipped two-dimensional array
960
+
961
+
@returns {Array} The two-dimensional array of regrouped elements
962
+
963
+
@example
964
+
var arr0 = [0, 1, 2];
965
+
var arr1 = [3, 4, 5];
966
+
var arr2 =_zip(arr0, arr1);
967
+
_unzip(arr2);
968
+
// => [[0, 1, 2], [3, 4, 5]];
969
+
970
+
```
971
+
972
+
### `_without(array, values...)`
973
+
974
+
Creates an array excluding all given values from amongst the elements of the given array
975
+
976
+
```gml
977
+
@param {Array} array The array to inspect
978
+
@param {*} values... The values to exclude
979
+
980
+
@returns {Array} The array of filtered elements
981
+
982
+
@example
983
+
var arr = [0, 1, 0, 2];
984
+
_without(arr, 0, 1);
985
+
// => [2];
986
+
```
987
+
988
+
### `_zip(arrays...)`
989
+
990
+
Creates a two-dimensional array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on.
991
+
992
+
```gml
993
+
@param {Array} arrays... The remaining arrays
994
+
995
+
@returns {Array} The array of elements grouped in arrays
0 commit comments