diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-01 17:34:26 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-01 17:34:26 +0000 |
| commit | 16d3cae5d3c3b03cbce26e0c897b28102a86795a (patch) | |
| tree | fc18eb870c6047b95da817865c551b846db01a15 | |
| parent | modularize (diff) | |
| download | alive-16d3cae5d3c3b03cbce26e0c897b28102a86795a.tar.gz alive-16d3cae5d3c3b03cbce26e0c897b28102a86795a.zip | |
add osc
| -rw-r--r-- | init.moon | 1 | ||||
| -rw-r--r-- | lib/osc.moon | 21 |
2 files changed, 22 insertions, 0 deletions
@@ -4,6 +4,7 @@ env = Registry! env\add_module 'math' env\add_module 'time' env\add_module 'util' +env\add_module 'osc' env\add_module 'debug' if ... == 'init' diff --git a/lib/osc.moon b/lib/osc.moon new file mode 100644 index 0000000..a99aab0 --- /dev/null +++ b/lib/osc.moon @@ -0,0 +1,21 @@ +import Op from require 'base' +import pack, unpack from require 'osc' +import dns, udp from require 'socket' + +class out extends Op + new: (...) => + super ... + + @@udp or= udp! + + setup: (@host, @port, @path, @value) => + + update: => + ip = dns.toip @host\get! + port = @port\get! + msg = pack @path\get!, @value\get! + @@udp\sendto msg, ip, port + +{ + :out +} |
