01-14-2022, 09:46 PM | #1 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,765
|
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.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
01-14-2022, 11:07 PM | #2 |
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 5,271
|
Lua's print works nicely on macOS and Linux. Since it's faster than ShowConsoleMsg, it's useful from time to time...
__________________
🎁 Donate (PayPal) | Sponsor (GitHub) | The Endless Journey (Keyboard Ensemble) ReaPack, a package manager for REAPER | SWS 2.14 is now available in ReaPack [new!] Developer tools: Lua profiler | Interactive ReaScript | ReaPack Editor | ReaImGui |
01-14-2022, 11:18 PM | #3 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,765
|
Oh, so it's actually a Windows issue? Hmm...
Where does it output the values?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
01-15-2022, 02:19 AM | #4 |
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 10,392
|
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.
__________________
Free ReaScripts - Premium Scripts - Custom Scripts Dev - Learn ReaScript - XR Theme - Stash Files - ReaLinks - Website - ReaComics - Alien 2347 - Donation |
01-15-2022, 04:45 AM | #5 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 16,525
|
just do this?
Code:
print=reaper.ShowConsoleMsg print("Hello world\n") Last edited by schwa; 01-15-2022 at 07:28 AM. |
01-15-2022, 07:26 AM | #6 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,126
|
perhaps we could mod lua's print() to output to OutputDebugString on win32...
|
01-15-2022, 11:19 AM | #7 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,765
|
@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.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
Thread Tools | |
Display Modes | |
|
|