Nope. Use gmatch like it says here: https://stackoverflow.com/questions/12211025/get-an-array-from-a-string-of-numbers-separated-with-comma
local output = { }
local str = "10,100, 1"
for match in str:gmatch("([^,%s]+)") do
output[#output+1] = tonumber(match)
end
Thanks!It seems one of the most direct ways. I’ve seen several weird or overly extensive things looking for google.
I have used something very similar. The result of the function:
--capture the native color of mark (C:\Users\USER_NAME\AppData\Roaming\Renoise\V3.1.1\Config.xml)
function crk_capture_clr_mrk()
--print ( os.currentdir() )
local filename = ( "%s\\Renoise\\V%s\\Config.xml"):format( os.getenv("APPDATA"), rns_version )
print( filename )
--RenoisePrefs
--SkinColors
--Selected_Button_Back
local pref_data = renoise.Document.create("RenoisePrefs") { SkinColors = { Selected_Button_Back = "" } }
pref_data:load_from( filename )
--print( pref_data.SkinColors.Selected_Button_Back )
local rgb = tostring(pref_data.SkinColors.Selected_Button_Back)
local one, two, thr = rgb:match( "([^,]+),([^,]+),([^,]+)" )
CRK_CLR.WHITE[1] = tonumber(one)
CRK_CLR.WHITE[2] = tonumber(two)
CRK_CLR.WHITE[3] = tonumber(thr)
end
crk_capture_clr_mrk()
The table CRK_CLR.WHITEget the RGB values of the “Selected_Button_Back” inside the Config.xml.
Config.xml:
<!--Skin Colors-->
<SkinColors>
<Main_Back>16,16,16</Main_Back>
<Main_Font>219,219,219</Main_Font>
<Alternate_Main_Back>15,16,16</Alternate_Main_Back>
<Alternate_Main_Font>212,212,212</Alternate_Main_Font>
<Body_Back>64,64,64</Body_Back>
<Body_Font>170,170,170</Body_Font>
<Strong_Body_Font>58,190,255</Strong_Body_Font>
<Button_Back>76,77,77</Button_Back>
<Button_Font>255,255,255</Button_Font>
<Button_Highlight_Font>255,181,35</Button_Highlight_Font>
<Selected_Button_Back>255,181,35</Selected_Button_Back>
<Selected_Button_Font>24,24,24</Selected_Button_Font>
…
I have a little doubt with the path to Config.xml.**os.getenv(“APPDATA”)**also serves for OSX and Linux? Or is it necessary to restrict it only for Windows?
What are the path of Config.xml for OSX or for Linux?