Return to Video

Lua Scripting with REAPER 5 - Part. 2: The API Documentation

  • 0:00 - 0:04
    Hello, this is X-Raym, for the
    second part of our Tutorial
  • 0:04 - 0:09
    on Lua scripts coding
    in REAPER 5.
  • 0:09 - 0:13
    In the first part,
    we saw how to use the console.
  • 0:13 - 0:17
    Now we will see how to
    find the documentation
  • 0:17 - 0:23
    to run more specifics action
    on REAPER objects
  • 0:23 - 0:28
    Regions, Tracks, Items, Takes...
    and other stuffs.
  • 0:28 - 0:33
    From REAPER, you can display
    the full functions list.
  • 0:33 - 0:41
    Avaible to ReaScript by doing
    Help -> ReaScript Documentation
  • 0:43 - 0:46
    An HTML document appears
  • 0:46 - 0:49
    which has been generated
    by REAPER
  • 0:49 - 0:52
    when you clicked on this action.
  • 0:52 - 0:56
    This means that this function list
    will be always up to date
  • 0:56 - 0:59
    when you use this method,
    which is extremly powerful.
  • 0:59 - 1:04
    The doc is generated
    when you open it.
  • 1:04 - 1:12
    However, we have to admit that it is
    a bit hard to look at first sight.
  • 1:14 - 1:18
    It lacks a bit of style,
    we will see an alternative later.
  • 1:19 - 1:26
    Here is the List of ReaScript Functions,
    there is many of them.
  • 1:26 - 1:33
    You don't have to learn everything,
    you will learn them when you'll need it.
  • 1:33 - 1:36
    Most of them will never
    be useful to you.
  • 1:36 - 1:39
    In order to make this document
    more pleasing to read,
  • 1:39 - 1:45
    I have created a mod of it,
    that I put online
  • 1:45 - 1:50
    http://bit.ly/reascript
  • 1:50 - 1:55
    that will display this page
  • 1:55 - 1:57
    (same as this one)
  • 1:57 - 2:05
    but with more features and
    a more readable text.
  • 2:05 - 2:13
    Having filterable function list
  • 2:14 - 2:20
    is a huge time saver
  • 2:20 - 2:27
    Without it, we are a bit lost
    when we need to find a specific function.
  • 2:27 - 2:33
    The downside of this, is that
    it will not always be up to date
  • 2:33 - 2:36
    I'll try to update it
    as much as I can,
  • 2:36 - 2:40
    But it is possible that what
    you are looking for
  • 2:40 - 2:44
    is new feature
    that I didn't implement yet
  • 2:44 - 2:48
    As you can see here,
    you can filter the functions
  • 2:48 - 2:54
    According to you needs. For example,
    if you want to find the functions
  • 2:54 - 2:56
    which are related to
    items and tracks
  • 2:56 - 2:58
    for example, this one.
  • 2:59 - 3:03
    You just have to type "item" and track
    and to click on it.
  • 3:03 - 3:06
    Here we see a
    function explaination.
  • 3:06 - 3:10
    It is written for the different
    languages we can use.
  • 3:10 - 3:17
    And you can see here in blue what type
    of value the function need and return.
  • 3:17 - 3:23
    For example, in this function,
    you have to put an Item as parameter
  • 3:23 - 3:25
    and it will return a track.
  • 3:26 - 3:32
    So, it is a function that allow
    to return the parent track of an item.
  • 3:32 - 3:38
    However, the details of the functions
    are not always written
  • 3:38 - 3:42
    It is more a reference document
    than a complete documentation.
  • 3:42 - 3:49
    It is confusing some times cause
    some functions have untold behaviors.
  • 3:49 - 3:53
    But for more common functions
    it is very nice.
  • 3:53 - 3:58
    So, we will try to find other functions...
  • 3:58 - 4:04
    THis one is very used,
    it means to display track infos.
  • 4:04 - 4:07
    We have to pass
    a track as 1st parameters
  • 4:07 - 4:11
    and a string as second parameters,
    and it will display a number.
  • 4:11 - 4:14
    The parameters here are listed below.
  • 4:14 - 4:22
    We can return the Mute state, Phase state,
    and it will be as a numerical vallue.
  • 4:23 - 4:25
    We will see that in practice
    in a next tutorial.
  • 4:26 - 4:33
    An other online ReaScript Doc Ressource
    is on the Cockos Wiki.
  • 4:33 - 4:39
    However, this page is obslete,
    car it was made from REAPER 3.15
  • 4:39 - 4:44
    Sure, because it is a Wiki
    every one is welcome for update it,
  • 4:44 - 4:51
    but it took a lot of times
    and each function has it's own page
  • 4:51 - 4:58
    in opposite to the auto-generated verson,
    where all is grouped in a single page.
  • 4:59 - 5:02
    Another way to have
    the function list
  • 5:02 - 5:06
    is to use an external code editor,
  • 5:06 - 5:09
    such as Notepad++
    or Sublime Text
  • 5:10 - 5:18
    For which some users have created files
    ReaScript functions Automcompletion Files.
  • 5:19 - 5:27
    For example, on N++, I have created a file which
    displays functions list when we type "reaper."
  • 5:32 - 5:35
    It can complete the function.
  • 5:35 - 5:41
    If I type GetMedia.. the
    function get completed.
  • 5:41 - 5:46
    To have Lua syntax colorisation
    with REAPER functions
  • 5:46 - 5:54
    You'll need to download this file.
    Install instructions are written there.
  • 5:55 - 6:02
    If you use Sublime Text, you will
    have a native Lua code colorisation
  • 6:02 - 6:07
    and if you need autocompletion,
    you will have to install an extension
  • 6:07 - 6:10
    which has been created by Breeder
    from the SWS REAPER extensions
  • 6:10 - 6:13
    which is call ReaSynax.
  • 6:13 - 6:17
    You can install it with
    Package Control Extension.
  • 6:17 - 6:23
    However, at this time, this extensions
    only manage REAPER functions in EEL.
  • 6:23 - 6:27
    Lua support may come
    for the next release.
  • 6:27 - 6:31
    I have to admit that ReaSyntax is
    far more easy to install
  • 6:31 - 6:34
    than my N++ files.
  • 6:34 - 6:38
    No matter what code editor you will choose,
  • 6:38 - 6:44
    Auto-completion is not indpensable
    for coding a script.
  • 6:44 - 6:48
    We continue our course
    by using Notepad++
  • 6:48 - 6:51
    but you can choose the
    code editor you want.
  • 6:51 - 6:58
    In the next tutorial, we will code
    our first useful script on items.
  • 6:58 - 6:59
    See ya!
Title:
Lua Scripting with REAPER 5 - Part. 2: The API Documentation
Description:

In this tutorial, you will learn how to find REAPER functions that we will use to build our future scripts.

Source Article:
http://extremraym.com/en/reascript-video-api-doc/

X-Raym ReaScript Doc Mod:
http://bit.ly/reascript

Sublime Text:
http://www.sublimetext.com/

Package Control for Sublime Text:
https://packagecontrol.io/

Breeder's ReaSyntax for Sublime Text:
https://packagecontrol.io/packages/ReaSyntax

Notepad++:
https://notepad-plus-plus.org/

X-Raym's ReaScript Monokai for Notepad++:
http://stash.reaper.fm/v/23811/notepadReaScriptMonokai.zip

Cockos Wiki - API Functions List
http://wiki.cockos.com/wiki/index.php/REAPER_API

Hope you still like the serie, feel free to make any suggestions !

more » « less
Video Language:
French
Duration:
07:00

English, British subtitles

Revisions