Architecture
Worp is written mostly in Lua (except for some C code for binding to the OS and Jack), and is run using LuaJIT. LuaJIT is an alternate implementation of the Lua language that is highly optimized and can deliver near native performance for numeric applications, which comes in handy for generating sound and doing digital signal processing.
Running code
At startup, Worp creates a Lua sandbox and is ready to receive Lua code to process. Any scripts to run at startup can be passed on the command line, or chunks of Lua code can be sent over a local TCP socket to the Worp process. The network connection is used by a Vim plug-in to send blocks or lines of code directly from the editor to Worp, which will compile and run the code without disrupting running audio.
Loading libraries
When worp encounters a reference to an undefined variable in the sandbox, it will check if a library is available which will provide this symbol, and load it on the fly.
The current method looks for a file with the given name in the ./lib directory, load the chunk and use the return value of the chunk.