Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 09-24-2018, 09:18 AM   #1
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 32
Default Lua and Python REAPER/SWS API files with documentation + descriptive parameter names

Hi everyone! Long time lurker, first time poster.

https://github.com/0xf0f/reaper-api

Here you can find REAPER and SWS API files for both Lua and Python with documentation and descriptive parameter names.
They are plug-n-play and can be used with existing projects seamlessly.

The main benefit of this is to make the API quicker and easier to work with in IDEs.

For example in PyCharm (Free Community Edition):


Or in IntelliJ IDEA (Free Community Edition) with the EmmyLua plugin (also available for PyCharm):



Instructions for Python:
- Place reaper_python.py and sws_python.py in your project folder and make sure to do 'from reaper_python import *' or 'from sws_python import *'. sws_python also imports everything in reaper_python so you don't need to do both.

NOTE: The Python files are missing RPR_defer, RPR_atexit and RPR_runloop as these were not included in the original API files either.

Instructions for Lua
- Place reaper.lua and gfx.lua in your project folder and in [Reaper Installation Folder]\lua, then make sure to import both as modules.

- If you'd like to forego placing reaper.lua and gfx.lua in [Reaper Installation Folder]\lua, you can add the following code to the top of your script:
Code:
package.path = package.path .. ';' .. debug.getinfo(1).source:match [[^@?(.*[\/])[^\/]-$]] .. "?.lua"
(With credit to Heda, Spk77 and X-Raym - https://github.com/ReaTeam/ReaScript...e%20script.lua)

This will also allow you to import other lua files in the same directory without having to place them in [Reaper Installation Folder]\lua

NOTE: Using reaper.lua and gfx.lua will incur an additional minor overhead as all API access will have to go through an extra layer of processing. You should remove or comment out `reaper = require 'reaper'` and `gfx = require 'gfx'` for release.

IDEs
If you'd like to use PyCharm or IntelliJ IDEA here are the download links. They're free! (select 'Community' on the right)
https://www.jetbrains.com/pycharm/do...ection=windows
https://www.jetbrains.com/idea/downl...ection=windows

Additional instructions:
By default PyCharm and IDEA are intended to primarily handle Python and Java, respectively. You can add Lua support by installing an additional plugin. I use EmmyLua. You can install this by going to File -> Settings -> Plugins -> Browse Repositories and typing 'EmmyLua' in the search box.

Also check out:
Breeder's ReaSyntax for Sublime Text (Now with Lua support)
https://forum.cockos.com/showthread.php?t=141221

X-Raym's Syntax Highlighting for Notepad++
https://forum.cockos.com/showthread....83#post1293983
https://forum.cockos.com/showthread.php?t=132924

Spk77's EEL language file for Notepad++
https://forum.cockos.com/showthread.php?t=173434

Michael Ellis' Lua Snippets for Atom
https://forum.cockos.com/showthread.php?t=173434

Last edited by meta; 09-29-2018 at 08:31 AM. Reason: Update: Added Lua API
meta is offline   Reply With Quote
Old 09-26-2018, 08:10 AM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 2,008
Default

I'm working on a documentation-generator myself, with a proper source-file as XML. It is still a few weeks away from being good enough, but it will be a good starting-source.
So, if you want to add Lua and Eel as well, this might help you with that, as you will be able to parse and convert it automatically, unlike the original documentation of ReaScript.
mespotine is offline   Reply With Quote
Old 09-28-2018, 09:47 PM   #3
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 32
Default

Quote:
Originally Posted by mespotine View Post
I'm working on a documentation-generator myself, with a proper source-file as XML. It is still a few weeks away from being good enough, but it will be a good starting-source.
So, if you want to add Lua and Eel as well, this might help you with that, as you will be able to parse and convert it automatically, unlike the original documentation of ReaScript.
Sounds neat! I'm currently using a script to scrape through the HTML document but having them all in XML form would certainly make things quicker!

I found out a way to do the Lua API and have updated the post to add this change.

Last edited by meta; 09-28-2018 at 10:14 PM.
meta is offline   Reply With Quote
Old 10-02-2018, 09:33 AM   #4
comarlopo
Human being with feelings
 
Join Date: Oct 2018
Posts: 10
Default Python problem

Hi everyone, I'm new to this forum and maybe this reply is a little bit out of the context of the thread but I've been trying to enable python for Reaper and I don't get what is wrong. I did everything that you can find in this forum. I'm using Reaper 5.95 and Python 3.7. Reaper doesn't recognize anything. Can anyone help me please?
comarlopo is offline   Reply With Quote
Old 10-04-2018, 04:38 AM   #5
meta
Human being with feelings
 
Join Date: Sep 2018
Posts: 32
Default

Quote:
Originally Posted by comarlopo View Post
Hi everyone, I'm new to this forum and maybe this reply is a little bit out of the context of the thread but I've been trying to enable python for Reaper and I don't get what is wrong. I did everything that you can find in this forum. I'm using Reaper 5.95 and Python 3.7. Reaper doesn't recognize anything. Can anyone help me please?
Hi, in case you haven't solved the problem yet here's how I've got mine set up:
Preferences -> Plug-ins -> ReaScript
In 'Custom path to Python dll directory': C:\Users\admin\AppData\Local\Programs\Python\Pytho n37
In 'Force ReaScript to use specific Python .dll': 'python37'

Hope that helps!
meta is offline   Reply With Quote
Old 10-04-2018, 10:13 AM   #6
comarlopo
Human being with feelings
 
Join Date: Oct 2018
Posts: 10
Default

Quote:
Originally Posted by meta View Post
Hi, in case you haven't solved the problem yet here's how I've got mine set up:
Preferences -> Plug-ins -> ReaScript
In 'Custom path to Python dll directory': C:\Users\admin\AppData\Local\Programs\Python\Pytho n37
In 'Force ReaScript to use specific Python .dll': 'python37'

Hope that helps!

Daaaaaamn I can't believe it! I was writting the hole path in 'Force ReaScript to use specific Python .dll' thank you so much!! You really save me hahaha
comarlopo is offline   Reply With Quote
Old 02-25-2020, 04:14 AM   #7
inarisound
Human being with feelings
 
inarisound's Avatar
 
Join Date: Dec 2016
Location: Los Angeles
Posts: 210
Default

Quote:
Originally Posted by meta View Post
Hi everyone! Long time lurker, first time poster.

https://github.com/0xf0f/reaper-api

Here you can find REAPER and SWS API files for both Lua and Python with documentation and descriptive parameter names.
They are plug-n-play and can be used with existing projects seamlessly.

The main benefit of this is to make the API quicker and easier to work with in IDEs.

I logged in just to say huge thank you... that is exactly what I was looking for!
inarisound is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.