|
|
|
01-18-2022, 12:58 PM
|
#1
|
Human being with feelings
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,799
|
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
|
|
|
01-18-2022, 01:35 PM
|
#2
|
Human being with feelings
Join Date: Jul 2013
Location: Québec
Posts: 484
|
Quote:
Originally Posted by Vagelis
[*] + MIDI editor: improve scroll behavior when adjusting zoom [ t=254669]
|
Thank you!
|
|
|
01-18-2022, 02:03 PM
|
#3
|
Human being with feelings
Join Date: Dec 2012
Posts: 13,333
|
Quote:
Originally Posted by Vagelis
+ ReaScript: Lua built-in print() function routes to OutputDebugString on Windows [ t=261902]
|
Perhaps we can see wrapping lines in IDE?
|
|
|
01-19-2022, 02:38 AM
|
#4
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Vagelis
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.
Last edited by amagalma; 01-19-2022 at 02:55 AM.
|
|
|
01-19-2022, 02:48 AM
|
#5
|
Human being with feelings
Join Date: Dec 2012
Posts: 13,333
|
Quote:
Originally Posted by amagalma
Where does the string appear?
|
Can't see it either.
|
|
|
01-19-2022, 05:20 AM
|
#6
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
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.)
|
|
|
01-19-2022, 05:43 AM
|
#7
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
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.
|
|
|
01-19-2022, 06:13 AM
|
#8
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
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.)
|
Ok then, sounds good! Thank you!
|
|
|
01-19-2022, 08:22 AM
|
#9
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,622
|
Quote:
Originally Posted by X-Raym
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
|
|
|
01-20-2022, 09:40 AM
|
#10
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@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.
|
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 07:28 AM.
|