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
Returns a DS_List containing the provided values. This DS_List should be destroyed as you would any other DS.
361
+
362
+
```gml
363
+
@param {*} values... As many starting values for the list as desired
364
+
365
+
@returns {DS_List} A new DS_List containing the provided values
366
+
367
+
@example
368
+
369
+
var list = _list_of(1, 2, 3, 4);
370
+
_log(list[| 2]) // logs 3
371
+
```
372
+
339
373
### `_log(values...)`
340
374
341
375
Convenience method for show_debug_message(). Automatically convetrs arguments to strings.
342
376
343
377
```gml
344
-
@param {Mixed} Message The message or value to log
378
+
@param {Mixed} Messages... The message or value to log
379
+
380
+
```
381
+
382
+
### `_map_of(values...)`
383
+
384
+
Returns a DS_Map containing the provided values. Arguments are split into key/value pairs in the order they are provided.
385
+
386
+
> *Note*: This script must take an even number of arguments. Keys can only be integers or strings.
387
+
388
+
```gml
389
+
@param {*} values... As many starting values for the map as desired
390
+
391
+
@returns {DS_Map} A new DS_Map containing the provided key/value pairs
392
+
393
+
@example
394
+
395
+
var map = _map_of(
396
+
"health", 100,
397
+
"mana", 20,
398
+
"level", 1
399
+
);
400
+
401
+
map[? "health"] // = 100
402
+
map[? "mana"] // = 20
403
+
map[? "level"] // = 1
345
404
346
405
```
347
406
@@ -445,11 +504,12 @@ _push([1, 2], 3);
445
504
446
505
### `_reduce(collection, reducer)`
447
506
448
-
Reduces a collection by iterating over it with a function. Provided script should take 2 arguments: total, value. On the first call, total is undefined.
507
+
Reduces a collection by iterating over it with a function. Provided script should take 2 arguments: total, value.
449
508
450
509
```gml
451
510
@param {Array|ds_list} collection The collection to reduce
452
511
@param {Script} recuderScript The script to reduce with
512
+
@param {*} value [Optional] The default value to begin reducing with. If not provided, the default is `undefined`
453
513
454
514
@returns {*} The reduced value from the given script
455
515
@@ -617,7 +677,9 @@ list[| 2]; // 10
617
677
618
678
### `_type_of(value)`
619
679
620
-
Returns the variable type of the given argument
680
+
Returns the variable type of the given argument as a string.
681
+
682
+
> *Note*: Works exactly as the native typeof(), though refers to `number` as `real` to be more consistent with GM:S terminology
0 commit comments