Renoise 3.1.1 - help with print() showing in terminal

Hello,

c# programmer and first time lua user.

i am writing a controller setup for my Arturia Keylab mkii and has been going well. I have written a custom function to overwrite the way duplex lights buttons as the keylab handles them differently, however i haven’t been able to get any of my print() to show in the terminal from my custom lua scripts so i cant see whats going wrong.

been searching around for an answer. i have managed to get the testpad.lua to print to terminal but none of my other scripts. is there something i am missing? do i need to connect the scripted i created to terminal somehow? i am running Windows 10.

Any information is greatly appreciated

Hello,

c# programmer and first time lua user.

i am writing a controller setup for my Arturia Keylab mkii and has been going well. I have written a custom function to overwrite the way duplex lights buttons as the keylab handles them differently, however i haven’t been able to get any of my print() to show in the terminal from my custom lua scripts so i cant see whats going wrong.

been searching around for an answer. i have managed to get the testpad.lua to print to terminal but none of my other scripts. is there something i am missing? do i need to connect the scripted i created to terminal somehow? i am running Windows 10.

Any information is greatly appreciated

Use the Renoise native terminal for scripting.

You can create any function, and within it invoke a print (). If you invoke the function, print () will work.

For example:

--define the function
local function the_print()
  local text = "The long text 1."
  print("Print inside the function:", text)
end

--invoke the function
the_print()

--or...
print("The long text 2.")

--or...
print(renoise.song().selected_line_index) --return a index number

To do tests, you can use the file TestPad.lua (“Execute” button), or your main.lua, after of write the code save the file.

You can use print(), oprint(), or rprint(), depending on what you need. Look in the documentation for what everything is.

Maybe you would find it more comfortable to use auto_reload_debug(“your_dialog”) inside your main.lua.Thus, each time you modify anything, it will autoexecute itself.

Maybe this forum should move elsewhere …

Are you sure your code is getting loaded?

https://forum.renoise.com/t/read-me-first-getting-started-with-renoise-lua-scripting/29140

There are 3 types of prints in Renoise. oprint for objects, rprint for tables, print for everything else.

Here’s a dbug print (from Grid Pie) that may help you. (It figures out which print to use automatically)

function dbug(msg)
  local base_types = {
    ["nil"]=true, ["boolean"]=true, ["number"]=true,
    ["string"]=true, ["thread"]=true, ["table"]=true
  }
  if not base_types[type(msg)] then oprint(msg)
  elseif type(msg) == 'table' then rprint(msg)
  else print(msg) end
end
1 Like

Are you sure your code is getting loaded?

Yep… that is the one. my folder/file names were not the same so my script wasn’t running my overriding class.

Thank you all for your information. It really helped out.

print() to show in the terminal from my custom lua scripts so i cant see whats going wrong.

Not to complicate things, but I want to point out that Duplex is making use of a method calledTRACE (link)

For large projects, this might be interesting as you can enable/disable which parts to show via pattern matching.

So you can mix this with smaller, more “temporary” print() statements if you like.