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

Reply
 
Thread Tools Display Modes
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: 5,270
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
Old 05-08-2022, 05:45 PM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,124
Default

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.
Justin is offline   Reply With Quote
Reply

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 12:50 PM.


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