Skip to content

Commit

Permalink
+ Changed ImplodeArray to utilize the string Join method.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidJSGardner committed Nov 26, 2024
1 parent dbe74b6 commit 563c61e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions scripts/include/arrays.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ use uo;
* Returns an error on failure.
*
*/
function ImplodeArray(glue, byref the_array)
if ( Lower(TypeOf(the_array)) != "array" )
return error{"errortext":="Object passed was not an array."};
endif
function ImplodeArray( glue, byref the_array )

var str_array := "";
foreach element in ( the_array )
str_array += (CStr(element)+glue);
SleepMS(2);
endforeach
if( TypeOfInt( glue ) != OT_STRING )
return error{ "errortext":="Object 'glue' passed was not a string." };
elseif( TypeOfInt( the_array ) != OT_ARRAY )
return error{ "errortext":="Object 'the_array' passed was not an array." };
endif

return str_array;
return glue.Join( the_array );
endfunction

/*
Expand Down

0 comments on commit 563c61e

Please sign in to comment.