How To Find Out Functions / Which Editing Tool For Lua?

Okay. I just got the SVN Repository of LUA scripts, and opened up RemoveTailSilence.xrnx/main.lua.

My question is this. I think I can vaguely understand what this all means, the text. It seems to be about including/requiring a function called remove_silence - and then adding a menu entry for Removing Tail silence from samples - which when invoked, invokes the function process_samples .

I’ve only really ever looked at code, not ever coded it myself. I have a few questions.

  1. Say I want to create a 2nd keybinding for Pattern Editor:Selection:Mark whole Track

    . I understand from looking at the RemoveTailSilence.xrnx/main.lua that I should at least start with getting the name of the shortcut into this :-speak that seems to be common.:
    add_menu_entry { name = “Pattern Editor:Selection:Mark whole Track”,

but then I have no idea what to make that invoke. It’s possible I’m already confused and would need to actually write a different name for that - and then call the function anyway – but how to find out what the name of this function is - if it is in any way similar to what this script itself does?

  1. I’ve often seen coders have these things where a specific function - when clicked upon, will show all the possible replacements that can exist - this often seems to be tied-in with the colorization of the piece of code. Is there a free tool like that for OSX? Im hoping that if I can just use a tool that displays all these possible functions in the API, that somehow this’ll help me memorize where they are and make more sense out of the scripts I’m seeing.

1:
To create a specific keybinding entry for the keyboard section you need to add something similar to this into the main scope of your lua code:

  
renoise.tool():add_keybinding {  
 name = "Sample Editor:Process:BeatSlicer",  
 invoke = function(repeated)  
 if not repeated then   
 show_dialog()   
 end  
 end  
}  
  

The naming convention depends on the existing keybinding trees in the “Keyboard Preferences”
You cannot create a new tree but you can create a new binding under existing trees.

2:Conner created php summarisation tables


You can download the html lists through the starters-pack, i don’t know if they are included in the 2.7 pack though.

Or did you mean editors that do auto-fill in when typing the partial name of the function?

This depends on the Text Editor / IDE and is a luxury feature. It’s not available in the built in Renoise text editor, I’ve not seen one decent one for Lua.

For example, I code in jEdit. It has a bunch of plugins to do the auto-replace and an exuberant ctags interface, but to get this all setup and working will take a newbie several days, and the results probably won’t be what you are expecting. You may have better luck with another editor.

@see: http://lua-users.org/wiki/LuaEditorSupport

That said you should not start this way. It’s like spending $500,000 on a home studio then saying “There! Now I’m ready to learn how to make music!” Stuff like this is only useful once you’ve paid your dues and know what is going on. There’s no easy way to learn to code.

You should look at Ledger’s sig which has links to beginners guides, and pick his brain if you can. He never coded before either. He has managed to script pretty cool stuff. None of his stuff is on the tools page because he’s a bit self conscious (?) but he’s kicking ass.

Good times.

I’m happy to say that with your help, I got this functioning:

  
local function panic()  
 do renoise.song().transport:panic()  
 end  
end  
renoise.tool():add_keybinding {  
 name = "Global:Transport:2nd Panic",  
 invoke = panic  
}  
  

I’ll keep hacking at this to find out what else one could do. My priority is of course to find the “Pattern Editor:Selection:Mark whole Track” and a few other adv.edit related things :) Anyway, I feel much better about trying to learn this stuff when something this simple can be made to work with a bit of thinking about it :)

Thanks to the help of bugonshoe + joule1 on irc, I also got “2nd editmode toggle” working:

  
function recon()  
 if renoise.song().transport.edit_mode then  
 renoise.song().transport.edit_mode = false  
 else  
 renoise.song().transport.edit_mode = true  
 end  
end  
renoise.tool():add_keybinding {  
 name = "Global:Transport:2nd Toggle EditMode",  
 invoke = function() recon()  
 end  
 }  
  

A bit more of lack of time at the moment to fix current bugs etc, so only 3 of the tools are up there for now. Thanks for kind words though.

Unfortunately a bit short of time for much brain picking at the moment aswell, but great to see you jumping into Lua esaruho, .

Some progress

I keep remembering and forgetting someone in this thread saying that there’s no way to KeyBind “Pattern Editor:Selection:Mark whole Track”. . Now that I re-read, nobody’s actually said that that’s undoable. Is this true??? :)

  1. Taktik says you cannot yet set a block selection.
  1. You can’t trigger keybindings from lua that already exists, and “mark whole track” is not available as a method in the renoise API.

(btw, If you want to manipulate the data of a whole track you’ll have to do it in another way than triggering a sequence of normal keybindings)

This incapability of creating 2nd block selection / 2nd Mark Whole track is quite intriguing, considering that trackers live from having as many ways as possible of selecting a block and doing something to it :)

D’you think it’d then be possible to “detect how many rows a pattern has” and then feed start-row number and end-row number to “Selection Start/Selection End” and thusly wrangle it, or is it just a case of waiting for API updates? :)

From what I’ve read on the forums setting a selection from lua is being planned.

Woo, awesome!! :)

I have checked that list and found this link thanks to which I have gained a free license of LuaCoding.

I have sent an email to sales at dfordsoft dot com saying that I code open source tools for Renoise, showing my tools, expliaining how you can get the code from Google Code and XRNX files and, after some days, they sent me the free license code.