Display a List on a Primitive

The following function formats a command string that can be passed to osSetDynamicTextureData in order to display the contents of the list input with a spacing of spacing pixels.

Example call:

osSetDynamicTextureData("", "vector", wasTextDisplayList(["hi", "there", "how", "are", "you"], 20), "width:256,height:256", 0);
///////////////////////////////////////////////////////////////////////////
//    Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3    //
///////////////////////////////////////////////////////////////////////////
string wasTextDisplayList(list input, integer spacing) {
    string c = "";
    integer p = 0;
    do {
        string in = llList2String(input, 0);
        c = osMovePen(c, 0, p);
        p += spacing;
        c = osDrawText(c, in);
        input = llDeleteSubList(input, 0, 0);
    } while(llGetListLength(input));
    return c;
}