Go Back   Cockos Incorporated Forums > REAPER Forums > Dstruct's Casa De Nitpicks

Reply
 
Thread Tools Display Modes
Old 01-14-2022, 09:46 PM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,765
Default Lua: replace Lua's print with ShowConsoleMsg()? (FIXED)

Lua has a built-in print-function which usually allows outputting text to the shell-window.
However, in Reaper the shell isn't available in that way and therefore outputs of print go into the void.

So I would propose, that print could be made another variant of reaper.ShowConsoleMsg(), so print outputs values to the ReaScript-console.

Less typing and that's really practical.
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-14-2022, 11:07 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 5,271
Default

Lua's print works nicely on macOS and Linux. Since it's faster than ShowConsoleMsg, it's useful from time to time...
cfillion is offline   Reply With Quote
Old 01-14-2022, 11:18 PM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,765
Default

Oh, so it's actually a Windows issue? Hmm...

Where does it output the values?
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-15-2022, 02:19 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 10,392
Default

print isn't strictly like showconsole msg though, as it adds breaks line to the end and do the string conversion. It can also takes multiple arguments.


If you want less typing, a simple Msg() function at top of the script can do the trick.


You can also reassociate named function to another function definition.


The fact that it doesnt behave the same in win and mac though might indeed ned consideration.
X-Raym is offline   Reply With Quote
Old 01-15-2022, 04:45 AM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 16,525
Default

just do this?

Code:
print=reaper.ShowConsoleMsg
print("Hello world\n")

Last edited by schwa; 01-15-2022 at 07:28 AM.
schwa is offline   Reply With Quote
Old 01-15-2022, 07:26 AM   #6
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,126
Default

perhaps we could mod lua's print() to output to OutputDebugString on win32...
Justin is offline   Reply With Quote
Old 01-15-2022, 11:19 AM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,765
Default

@Justin
That would be great

@Schwa @X-Raym
Yeah, but to do this in every new script is quite tedious. Having it natively available would be really neat.

It's no dealbreakee but one of the nice things making everyday coding a little faster.
Meo-Ada Mespotine 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 01:04 PM.


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