View Single Post
Old 05-28-2019, 12:45 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
+ ReaScript: support changing the returned field separator in GetUserInputs function
Oh many thanks !

Very good start: if the character can be encoded in a single byte it works.

Code:
separator = "#"

retval, retvals_csv = reaper.GetUserInputs("Title", 2, "CSV 1, CSV2,separator=" .. separator, '')

if retval then
  t = {}
  i = 0
  for line in retvals_csv:gmatch("[^" .. separator .. "]*") do
      i = i + 1
      t[i] = line
  end
end
It seems to work with new line character which is quite good in this case as fields are single line.

Code:
separator = "\n"
But it breaks with null character

Code:
separator = "\0"
(it doesn't add null characters to the returned string).
X-Raym is offline   Reply With Quote