Here is a workarround (with SWS extension check) The trick is to loop in reaper function table and store existing key (aka function names) in a table, and check if an extension function (no matter which one) exist in this table or not. It doesn't return REAPER error if it doesn't exist. EDIT: code snippet updated with new method, base don NammedCommand
------------------------------ 2007 Odyssey EX-L RES (mods Birtax Regent & Roundabout) 1994 Volvo 850 (mods Britax Marathon) had 1992 325i sold 10/1991 build 325i (Dinan chip, Eibach springs, 99 M3 muffler) 1994 Accord EX-L sedan (stolen!) 1972 Pontiac Grand Ville coupe (that's 45
It's not a perfect workaround though. pairs(reaper) seems to be giving "ghost" functions, such as: 'reaper.ov_info' is unknown 'reaper.ov_pcm_total' is unknown 'reaper.wave__createMetadataSource' is unknown They are functions (type(v) == 'function'), but when called they throw the dreaded non-catchable "is unknown" error. Code:
------------------------------ i ahve big hair i cant spell or type,, get over it
@X-Raym Nice trick for checking SWS's presence. :) Summary of the bugs/annoyances so far: "reaper.xyz is unknown" error always stop the script execution when using reaper.defer() and clicking on the "Continue" button when the IDE is closed "reaper.xyz is unknown" error cannot be caught by lua's pcall() unlike other lua/reascript errors reaper['inexistant'] behavior is inconsistent with lua table behavior: it throws an error instead of returning nil EDIT: This one is fixed in REAPER 5.23pre1! pairs(reaper) gives ghost (uncallable and undocumented) functions EDIT: Fixed in v5.23pre2! (These all affect my script, I guess it's kind of an edge case...)
This is all fairly complicated under the hood. However, it should be easy for us to add an API function API_exists("function_name"), does that get you where you want to be?
------------------------------ E34 540i Manual Eibakh Pro Kit
On second thought, we'll do both. The next build will add APIExists("function_name"), and also treat reaper.* as a generic table with respect to getting and setting elements. So reaper.somefunction will be nil if somefunction() is not defined in the particular version of REAPER that is running the script. As a side effect you'll be able to set reaper.whatever="foo" and that will work too, though that's somewhat pointless.
Awesome, thank you! Will gfx also be changed? Currently it has the same "is unknown" behavior and non-function indexes – x, w, mouse_cap etc – are not listed by pairs(gfx). EDIT: it is :)