KAKAN

JoinArray

Feb 9th, 2017
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.31 KB | None | 0 0
  1. // The Function.
  2. function JoinArray( array, delimit ){
  3.     return array.reduce( function( prevData, nextData ){ return ( prevData + delimit + nextData ); } );
  4. }
  5.  
  6. // TEST:-
  7. local testarray = ["A","quick","brown","little","fox"];
  8. print( JoinArray( testarray, " " ) );
  9.  
  10. // OUTPUT:-
  11. // A quick brown little fox
Add Comment
Please, Sign In to add comment