top of page

14

Beginner

AZSTOKe_sample_textSliceChenger

[#] Split and obtain delimited string

RANK

function Msg(param)

    reaper.ShowConsoleMsg(tostring(param).."\n")

end

s = "1,2,3,4,5,6#1,1,1,0,1,1#3,4,5,4,5,65,4,6"


function  textSliceChenger(str)

local c = 0

local y = {}

    for x in str:gmatch("([^#]*)")do

        c = c + 1

        y[c]= x

    end

return y

end


a = textSliceChenger(s)

Msg(a[1])

Msg(a[2])

Msg(a[3])

function Msg(param)

     reaper.ShowConsoleMsg(tostring(param).."\n")

end


  • Set Msg console output function


s = "1,2,3,4,5,6#1,1,1,0,1,1#3,4,5,4,5,65,4,6"


  • Prepare a string separated by "#".


function  textSliceChenger(str)


  • Define a function that stores "#" delimited strings in an array.


local c = 0

local y = {}


  • Define a variable for counting and an array for storing the return value.


for x in str:gmatch("([^#]*)")do

c = c + 1

y[c]= x

end


  • Splits the argument (str) using "#" and repeats the process for the number of strings after splitting.

  • Add variable (c) each time it repeats.

  • Store the divided string in the (c)th position of the array.


return y

end

To use the API, you need to sign up for a plan.

Download the dedicated API

need to do it.

*SILVER is scheduled to be released in May.

No preparation required

- Script Code -
- Script Image -
- Warm Up -
- Script Detail -
- API -

LUA

​ReaScript File Download 👇

* A dedicated API is required to run this

- Script Image -
bottom of page