Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 05-08-2022, 03:12 PM   #1
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,670
Default 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;
}
cfillion is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.