View Single Post
Old 02-01-2019, 02:36 PM   #233
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by reapero View Post
Hey, dumb question probably but how come this:

Code:
retval, fileNames = reaper.JS_Dialog_BrowseForOpenFiles( "Select files", "C:\\", _, _, true )

reaper.ShowConsoleMsg(fileNames)
returns only the path, and not the file names?
The API function actually returns the path and all the file names, as Mespotine described. The problem is simply a display issue: REAPER's IDE and Console assume that all strings are null-terminated "C strings", and only display strings up to the first \0, so it may seem as if a string is not complete.

A related issue is that the IDE and Console don't display floating point values to the full precision, and only display about 14 digits. So don't always trust what you see in the display...

Under the hood, REAPER knows the entire string and the full precision numbers.

Lua strings aren't null-terminated, and Lua itself doesn't actually care about \0 characters inside strings. For example, when MIDI events are packed into strings for MIDI_Get/SetAllEvts, the string contains lots and lots of \0 bytes.
juliansader is offline   Reply With Quote