If you want to live-code directly in a DAW from a plugin, there is Lua Protoplug. It's completely centered on being a plugin, so your script processes blocks of sound/MIDI as requested by the host (here's a MIDI in/out example [1]). And yes, I know, I haven't pushed a commit in a few months. I still have many ideas and improvements for when I get back to it though!
[1]: http://www.osar.fr/protoplug/api/examples/midi-chordify.lua....