Skip to content

Repository files navigation

HxReaScript

Haxe externs(bindings) for Reaper's Lua ReaScript variant, write your Reaper plugins in Haxe and compile to Lua for ReaScript.

Currently in Alpha, major changes may be made in the future

The Haxe externs are generated via the reascript2hx parser for lua documentation files provided by vscode-reascript-extension.

Getting Started

  1. Install Haxe
  2. Add HxReaScript to haxelib haxelib git hxReaScript https://github.com/inc0der/HxReaScript
  3. Create your .hxml file add hxReaScript as a library and target Lua.
# Main plugin class
-main Main

# Add hxReaScript as library
-lib hxReaScript

# Use vanilla lua to avoid pulling in other dependencies (unless you need them)
-D lua-vanilla

--lua bin/lua/main.lua

The generated classes expose the ReaScript API directly. For more convenient workflows, use the small handwritten helpers in reaper.ReaperTools:

import reaper.ReaperTools;

var track = ReaperTools.selectedTrack();
if (track != null) {
  var name = ReaperTools.trackName(track);
}

ReaperTools.withUndo("Rename selected track", function() {
  // Reaper edits go here.
});

The generated externs can be replaced from reascript2hx without overwriting these helpers.

Updating externs

The generator is a development-only dependency. After installing the Node development dependencies, regenerate the raw externs with:

npm install
npm run generate-externs

This updates only reaper/Reaper.hx, reaper/Graphics.hx, reaper/ImGui.hx, and reaper/Types.hx. Handwritten helpers such as reaper.ReaperTools remain outside the generated output.

Note

Since it appears many of the C++ and Lua method names are similar this may be a good base to compile to the C++ ReaScript variant in future revisions.

About

Haxe externs(bindings) for Reaper's Lua ReaScript variant, write your Reaper plugins in Haxe and compile to Lua for ReaScript.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages