Lua: "reaper.xyz is unknown" >>
Forum

Forum



SearchSearch   Users   Registration   Entrance
Today: 11.08.2025 - 21:21:19
Pages:  1  

Lua: "reaper.xyz is unknown"

Advertising


MessageAuthor

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

mpeng168

user forum




Statistics:
Messages: 235
Registration: 08.12.2003
08.12.24 - 04:02:27
Message # 1
RE: Lua: "reaper.xyz is unknown"

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

ETA fro

user forum




Statistics:
Messages: 162
Registration: 12.08.2003
08.12.24 - 04:13:52
Message # 2
RE: Lua: "reaper.xyz is unknown"

@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...)

------------------------------
- Roman

BGM3

user forum




Statistics:
Messages: 2,683
Registration: 08.30.2001
08.12.24 - 04:22:46
Message # 3
RE: Lua: "reaper.xyz is unknown"

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

Mohamed 525i

user forum




Statistics:
Messages: 624
Registration: 06.18.2003
08.12.24 - 04:32:43
Message # 4
RE: Lua: "reaper.xyz is unknown"

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.

------------------------------
[turbo m10 engine build photogallery]

jbob

user forum




Statistics:
Messages: 3,165
Registration: 07.17.2002
08.12.24 - 04:36:08
Message # 5
RE: Lua: "reaper.xyz is unknown"

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 :)

------------------------------
Kiley- '05 MR

kiley_sean

user forum




Statistics:
Messages: 697
Registration: 02.25.2002
08.12.24 - 04:42:15
Message # 6
RE: Lua: "reaper.xyz is unknown"

With the latest SWS (2.12.1)? It works here:

------------------------------

NickBooras

user forum




Statistics:
Messages: 87
Registration: 01.20.2002
08.12.24 - 04:50:41
Message # 7
RE: Lua: "reaper.xyz is unknown"
For AC-7 / AC-7 Pro users... : Previous topic
Pages:  1  

Message
Name
Message

Click on the dot next to the name to address the participant

           
   
The administrator has prohibited guests from replying to messages! To register, follow the link: register


Participants