Old 01-18-2022, 12:58 PM   #1
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,799
Default v6.46rc2 - January 18 2022

v6.46rc2 - January 18 2022
  • + Batch converter: fix normalization (6.44 regression) [t=262025]
  • + MIDI editor: improve scroll behavior when adjusting zoom [t=254669]
  • + ReaScript: Lua built-in print() function routes to OutputDebugString on Windows [t=261902]
This thread is for pre-release features discussion. Use the Feature Requests forum for other requests.

Changelog - Pre-Releases
Vagelis is online now   Reply With Quote
Old 01-18-2022, 01:35 PM   #2
STOP
Human being with feelings
 
STOP's Avatar
 
Join Date: Jul 2013
Location: Québec
Posts: 484
Default

Quote:
Originally Posted by Vagelis View Post
[*]+ MIDI editor: improve scroll behavior when adjusting zoom [t=254669]
Thank you!
STOP is online now   Reply With Quote
Old 01-18-2022, 02:03 PM   #3
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by Vagelis View Post
+ ReaScript: Lua built-in print() function routes to OutputDebugString on Windows [t=261902]
Perhaps we can see wrapping lines in IDE?
vitalker is offline   Reply With Quote
Old 01-19-2022, 02:38 AM   #4
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by Vagelis View Post
v6.46rc2 - January 18 2022
  • + ReaScript: Lua built-in print() function routes to OutputDebugString on Windows [t=261902]
Thank you devs for this!

Where does the string appear?

edit: The screen appears if I use DebugView, but what is the use of the print function if one needs another app to see its output?

I would prefer the print function to be hard-wired to:
Code:
function print(...)
  local t = {...}
  for i = 1, #t do
    t[i] = tostring(t[i])
  end
  reaper.ShowConsoleMsg(table.concat(t, "\t").. "\n")
end
So, we don't need an additional app.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 01-19-2022 at 02:55 AM.
amagalma is offline   Reply With Quote
Old 01-19-2022, 02:48 AM   #5
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by amagalma View Post
Where does the string appear?
Can't see it either.
vitalker is offline   Reply With Quote
Old 01-19-2022, 05:20 AM   #6
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

If you want to redirect Lua's print to the reascript console, do this:

Code:
print = reaper.ShowConsoleMsg
We didn't want to do that by default because on Mac, Lua's print currently sends output to a system console window if one is open, which is potentially useful for debugging, separately from the reascript console, which is often used for user feedback.

On Windows, Lua's print output doesn't go anywhere. This change redirects it to print to the standard Windows debug message path, which is typically viewed with the DebugView application. This is more or less what a Windows programmer would expect and is potentially useful as a separate facility from the reascript console window. (Try opening DebugView and running some plugins, you will probably see some that send debug output there.)
schwa is offline   Reply With Quote
Old 01-19-2022, 05:43 AM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Quote:
print = reaper.ShowConsoleMsg

Or



Code:
print = function( val ) reaper.ShowConsoleMsg( tostring( val ) .. "\n" ) end

else it will return error message if "nil", a table or a userdata is passed, and will not have break line.
X-Raym is offline   Reply With Quote
Old 01-19-2022, 06:13 AM   #8
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by schwa View Post
...This is more or less what a Windows programmer would expect and is potentially useful as a separate facility from the reascript console window. (Try opening DebugView and running some plugins, you will probably see some that send debug output there.)

Ok then, sounds good! Thank you!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 01-19-2022, 08:22 AM   #9
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,622
Default

Quote:
Originally Posted by X-Raym View Post
Or



Code:
print = function( val ) reaper.ShowConsoleMsg( tostring( val ) .. "\n" ) end

else it will return error message if "nil", a table or a userdata is passed, and will not have break line.
Or go even further and display all parameters up to the first nil-parameter, which seems to be, how the original print in Lua works:
Code:
function print(...)
  local stringer=""
  local count=1
  local temp={...}
  while temp[count]~=nil do
    stringer=stringer.."\n"..tostring(temp[count])
    count=count+1
  end
  if stringer:sub(-1,-1)=="\n" then stringer=stringer:sub(1,-2) end
  stringer=string.gsub(stringer, "\0", ".")
  reaper.ShowConsoleMsg(stringer:sub(2,-1).."\n")
end
Quote:
Originally Posted by schwa
...This is more or less what a Windows programmer would expect and is potentially useful as a separate facility from the reascript console window. (Try opening DebugView and running some plugins, you will probably see some that send debug output there.)
Ah, nice to know that. Thnx
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is online now   Reply With Quote
Old 01-20-2022, 09:40 AM   #10
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@meo-ada mespotine
This is more clear IMHO :P



Code:
function print( ...) 
  local t = {}
  for i, v in ipairs( { ... } ) do
    t[i] = tostring( v )
  end
  reaper.ShowConsoleMsg( table.concat( t, "\n" ) .. "\n" )
end

I use table concat for concizion and for optimization (though in this context it might not make a huge difference, cause print is rarely called with tons of parameters):

Quote:
If you need to perform many concatenation operations, using the concatenation operator can be slow because Lua has to keep reallocating memory to create new strings.
X-Raym 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 07:28 AM.


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