ReaScript: Lua passes incorrect string size to myFunc(char* myName, int myName_sz)
If an extension-provided API function takes a string as input, and if the parameters are defined/documented as "char* myName, int myName_sz", REAPER recognizes these as a pair, and the "int myName_sz" becomes an optional parameter (in Lua and EEL) that REAPER automatically fills with some number -- presumably the size of the string.
However, the number that is passed to the extension differs depending on whether Lua or EEL is used: The Lua number is incorrect, and is always 2 less than the EEl number.
For example, "12345" is passed, Lua will send a size of 4, and EEL will send a size of 6. The EEL size is correct, if the terminating \0 is included.
|