Caveats and Cautions
7.05 Caveats and Cautions:
During development there were times when a script would crash. There were also times where it would also crash Reaper. I believe the crashes were related to one of the following:
json.encode using json.lua
dh_Toolkit scripts use json.lua by rxi to encode data for saving to Reaper ExtState. Trying to encode values which are unrepresentable in JSON will never result in type conversion or other magic: sparse arrays, tables with mixed key types or invalid numbers (NaN, -inf, inf) will raise an error.
reaper's "gfx" graphics engine
Menubar and Menubox mouseup events call gfx.showmenu. Calling gfx.showmenu will crash Reaper if string parameter is nil or empty. Needs at least one space " ". gfx.drawstring is similar. It needs at least an empty string "". Be sure to provide proper string to elements requiring them.
REASCRIPT FATAL FLAW:
Say a script contains the following code:
	if self.cap_centered then
	    gfx = self.x + (self.w - str_w) / 2
	else
        gfx.x = self.x + self.cap_pad_x
gfx (not gfx.x) was inadvertently set to a number value so the script crashes, and takes everything with it. Everything fades and the error message box just reopening when you try to close it. Cannot close Reaper as it has become unresponsive. In Windows one needs to open the Task Manager ("Ctrl+Alt+Del"), search for the Reaper process, End Task.

Be careful of your gfx assignments!


Clicking on Menubar or Menubox calls gfx.showmenu which displays a popup menu. The font and font-size used in the popup menus are determined by the operating system and cannot be changed by the script.