- Script Code -
dofile(reaper.AZ_GetLuaInitPath())
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 = textSliceChanger(s)
Msg(a[1])
Msg(a[2])
Msg(a[3])
- Warm Up -
No preparation required
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
Loading the initial settings for the Lua version of RIGDOCKS
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 the "#" delimited string in an array.
local c = 0
local y = {}
Define a variable for counting and an array for storing return values.
for x in str:gmatch("([^#]*)")do
c = c + 1
y[c] = x
end
The argument (str) is split at "#" and the process is repeated for each split string.
The variable (c) is incremented each time.
The split string is stored in the (c)th position of the array.
return y
end