Reaper is missing Lua Auxlib in it's embedded version of Lua. As such things such as the luasockets library etc will not work. If loaded they will throw an error for missing symbols when the library tries to access those in the missing AuxLib.
Until the REAPER devs fix this, we have to work around the issue. This project does that for all all three REAPER platforms.
So far I have built the Lua ZeroBrane Debugging based on this package. Mavriq LuaSockets comes with support for raw, UDP, SMTP, FTP and HTTP. Sorry HTTPS isn't available yet, but there is a sister package I will soon incorporate.
Danial Lumertz has an excellent thread here with example how to use it.
This may be a one line fix depending on how Lua was added to Reaper. Typically Lua is embedded by including the headers like the code below. If so the header for lauxlib.h
is missing.
extern "C" { #include "lualib/lua.h" #include "lualib/lauxlib.h" #include "lualib/lualib.h" }
To fix the missing library we need to build a version of sockets with the Lua library statically linked. This will "override" the version of Lua built into reaper. All Lua calls by the sockets library will use the statically linked version.
You can find builds under releases on GitHub, or you can install via ReaPack.
Each platform has it's own quirks in making a library. In addition I wanted to come up with a solution that could be built entirely from the command line so it could be automated. You can find the workflow YAML under the Actions
tab in GitHub
for the project. These are NOT step by step instructions but a how to for the general concept.
Platform | Description |
---|---|
Windows | Lua Library Download the official 5.3.6 static binaries from SourceForge. Luasockets Clone the git repository for luasocket https://github.com/lunarmodules/luasocket. Some changes are needed to the Visual Studio solution included with the project, or you can use the MSBuild command line tool: msbuild socket.vcxproj |
macos | Lua Library Download the official 5.3.6 sources from https://www.lua.org/ftp/lua-5.3.6.tar.gz and build. Luasockets Clone the git repository for luasocket https://github.com/lunarmodules/luasocket. Several changes are needed in the makefile under the src directory: LUAV?=5.3Copy the static lua lib and needed headers to the src dir and build. One issue with the mac version is code signing. A security message will pop up on the first load, and the user will need to add the appropriate permissions under the system settings. While it is possible to sign it, it makes little sense to do so. Modules have to be signed by the same team as the main app in macos. Since that isn't possible in this case, signing only changes the security message to something more confusing than the original message. There is code to sign the library in the workflow yaml that has been commented out if you want to do it anyway. |
Linux | Lua Library Download the official 5.3.6 sources from https://www.lua.org/ftp/lua-5.3.6.tar.gz. You need to change a couple of lines in the makefile in the src directory: MYCFLAGS= -fPICor the library won't work when linked into luasockets. Luasockets Clone the git repository for luasocket https://github.com/lunarmodules/luasocket. Several changes are needed in the makefile under the src directory: LUAV?=5.3Copy the static lua lib and needed headers to the src dir and build. |