Reply To: Lua in Ctrlr – list of frequently used commands

Home Forums General Programming Lua in Ctrlr – list of frequently used commands Reply To: Lua in Ctrlr – list of frequently used commands

#14112
lfo2vco
Participant
    • Topics: 26
    • Replies: 162
    • Total: 188
    • ★★

    OK, I have a couple of useful functions that can be applied to strings containing patch names for instance.
    —————————————————————————————————————
    The following Function extracts a piece of the string from characters 1 to 16

    function edit (s)
    	return (string.sub(s,1,16))
    end
    
    nameEdit = (edit(myString))

    —————————————————————————————————————
    The following Function removes whitespace (spaces) from either end of a string

    function trim (s)
    	return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
    end
    
    nameTrim = (trim(myString))

    —————————————————————————————————————

    Hope these prove useful to others.

    Here is some noise I organised into an acceptable format:
    https://soundcloud.com/lfo2vco/a-dark-crystal

    Ctrlr