///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
// Returns a list containing all unique file descriptors.
list wasPrimFSGetDescriptors(integer head, integer tail) {
    list descriptors = [];
    do {
        string d = wasGetLinkDescription(tail);
        if(llStringLength(d) == 0) jump continue;
        list c = llList2ListStrided(
            llParseString2List(d, ["&", "="], []), 
            0, -1, 2
        );
        // GC
        d = "";
        do {
            string k = llList2String(c, 0);
            if(llListFindList(
                descriptors, (list)k
                    ) != -1) jump skip;
            descriptors += k;
            // GC
            k = "";
@skip;
            c = llDeleteSubList(c, 0, 0);
        } while(llGetListLength(c) != 0);
        // GC
        c = [];
@continue;
    } while(--tail>=head);
    return descriptors;
}