Tprint

this prints the contents of a table.
paste the following in terminal or put it in a lua file and execute it then run tprint(table).

function tprint(a)
for k,v in pairs(a) do print(k,v) end
end

rprint does tables?

  
my_table = {1. 4. 9}  
rprint(my_table)  
  
[1] => 1  
[2] => 4  
[3] => 9  
  

What would be extremely useful would be a shorter alias for print(string.format())

Here’s my “eat all” debug function:

  
-- Debug print  
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  
  
  
function foo(scheme, ...)  
 print((scheme):format(unpack(arg)))  
end  
  
foo("The answers are %d and %d", 42, 24)  
  

?

Argh, crap. Sorry guys. This is the Beginners forum. Didn’t notice.

Is it possible to make a function like this available from the lua terminal in Renoise? Perhaps there is some default init file or something…

haha, way too good conner. i’m trying to share tips that i hope will be as useful to them as much as they are to me.