JoinArray, GetTok

Started by KAKAN, Feb 09, 2017, 06:20 PM

Previous topic - Next topic

KAKAN

Well, I've seen many people using a inefficient method for joining arrays. By seeing the function, I got to know that the person who wrote that function has not touched the squirrel documentation. There's already a function given for joining arrays. Without anything further, here's the code, enjoy.
http://pastebin.com/fZCvE4Eg
This might not be the most efficient method, but atleast more efficient than the older function used for Joining arrays.
ex:-
local testarray = ["A","quick","brown","little","fox"];
print( JoinArray( testarray, " " ) );
OUTPUT:-
A quick brown little fox
oh no

KAKAN

#1
Here's a clean implementation of GetTok too:-
http://pastebin.com/fLTXmNb6
Test is posted there.
oh no