Implode DS List by Delimiter GML Script

For the reverse of  Explode, we can implode a DS List back into a delimited string with this script.

///implode(list, delimiter)
///@param list
///@param delimiter

var list = argument0;
var delimiter = argument1;

var str = "";
for(var i = 0; i < ds_list_size(list); i++){
    str += list[| i];
    if(i < ds_list_size(list) - 1){
        str += delimiter;	
    }
}

return str;

 

Leave a Reply

Your email address will not be published. Required fields are marked *