Couple of general script observations:
- Lua can do block comments rather than having to comment each line if you want:
Code:
--[[
Blah
blah
blah
blah blah blah
blah
]]--
- You should be able to use
/ as a file separator on both Windows and OSX without any trouble. Windows will quite happily let you mismatch them:
C:/Users\\Me\\AppData/Roaming/Reaper/Scripts\\ReaTeam Scripts/stuff.lua
- Reaper has a function for getting values from an .ini if you want:
retval, string = reaper.BR_Win32_GetPrivateProfileString( sectionName, keyName, defaultString, filePath ). Ignore the name; it should work on OSX just fine.
- You can wrap
ShowConsoleMsg in a helper function to save a bit of typing, and having to remember the
\n each time - in fact,
GUI.Msg("my string") is ready to do it for you.
You can also include the debug check in a helper rather than having to check each time:
Code:
local function Msg(str)
reaper.ShowConsoleMsg( tostring(str) )
end
local function dMsg(str)
if debug_enabled then reaper.ShowConsoleMsg( tostring(str) .. "\n" ) end
end
debug_enabled = true
Msg("this will always print")
dMsg("this will print")
debug_enabled = false
dMsg("this won't print")