[Include] Dynamic String Splitter [Enumerator Functions Included!]
#10

Alright, so the include has been updated! It has completely new functions in addition to newly introduced string-related functions and global no-data-type-specific functions (therefore, I don't feel the need in replying to the replies above), that are vastly better and more useful (since the initial attempt ended up having to use ugly loops outside the functions, not to mention the loop inside each function to get a count so it could be used in another loop...).

Anyhow, this ugly mess:
PHP код:
new integers[MAX_INV_ITEMS*2], countlimit sizeof (aInventory[])/2;
for (new 
iksplit_integers(item_info"|"integers); ji++)
{
    for (
0sizeof (aInventory[][]); k++) // I removed "new" and added it to the main loop too, because it's better for optimization. (Creating stuff in loops = bad idea)
    
{
        
aInventory[playerid][count][eInventoryk] = integers[count+k];
    }
    
count++;
    if (
count == limit)
        break;

Turns into (which is also a lot more efficient as SSCANF does most of the work now):
PHP код:
new sscanf_format[30]; 
SplitIntegers_IndexesEnum(string_to_split"|"aInventory[playerid], "ii""ii"sscanf_format); 
The best part is that you can specify the amount of cells the functions will build up in order to split strings (think of it as query used in SQL functions, but inverse). Meaning, there's no limit and it will speed up short to long processes (the more cells there are, the longer it takes).

Check out the main post for more information, and for the download link! Don't forget to check out the example file too!

Also, thanks to everyone!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)