Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: KAKAN on Feb 09, 2017, 06:20 PM

Title: JoinArray, GetTok
Post by: KAKAN on Feb 09, 2017, 06:20 PM
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
Title: GetTok
Post by: KAKAN on Feb 09, 2017, 06:40 PM
Here's a clean implementation of GetTok too:-
http://pastebin.com/fLTXmNb6
Test is posted there.