|
|
Thread Tools | Display Modes |
|
05-08-2022, 03:12 PM | #1 |
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 5,270
|
Optional string arguments are never NULL in Lua extension functions (FIXED)
REAPER always gives a non-NULL string to 'const char*' optional arguments of extension functions, even if the caller omitted them or passed nil/0. This prevents distinguishing between omitted vs empty strings and providing a non-empty default.
int and double optional args can receive NULL as expected. Code:
plugin_register("APIdef_Test", "bool\0const char*\0strInOptional\0\0"); bool Test(const char* strInOptional) { return strInOptional != NULL; }
__________________
🎁 Donate (PayPal) | Sponsor (GitHub) | The Endless Journey (Keyboard Ensemble) ReaPack, a package manager for REAPER | SWS 2.14 is now available in ReaPack [new!] Developer tools: Lua profiler | Interactive ReaScript | ReaPack Editor | ReaImGui |
05-08-2022, 05:45 PM | #2 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,124
|
Ah yeah, hmm. This was intentional, not sure if changing that will break something in another extension. Edit: ah yeah, EEL2 passes NULL for these so it should be ok I think!
Last edited by Justin; 05-09-2022 at 04:15 AM. |
Thread Tools | |
Display Modes | |
|
|