GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2022-10-20 18:10:11

gnysek
Member
Registered: 2011-12-29
Posts: 36

array_sum [2022.11+]

Expand/// @desc returns sum of elements in array
/// @param {Array} a
function array_sum(a) {
	return array_reduce(a, function(p, v, i) {return p+v;});
}

example:

Expandarray_test = [10, 20, 70];
show_debug_message(array_sum(array_test));
// returns 10+20+70 = 100

Offline

Board footer

Powered by FluxBB