diff options
| author | s-ol <s+removethis@s-ol.nu> | 2023-11-11 15:52:08 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 31603cdcf26fd6a5ba7ee600b601f50dd6c17517 (patch) | |
| tree | 641196fe3cd459b8e10e263c249940b17bc419ea | |
| parent | small fixes (diff) | |
| download | alive-31603cdcf26fd6a5ba7ee600b601f50dd6c17517.tar.gz alive-31603cdcf26fd6a5ba7ee600b601f50dd6c17517.zip | |
small fixes
| -rw-r--r-- | alv/builtins.moon | 2 | ||||
| -rw-r--r-- | alv/copilot/udp.moon | 11 | ||||
| -rw-r--r-- | alv/scope.moon | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/alv/builtins.moon b/alv/builtins.moon index 9cd54bb..f612203 100644 --- a/alv/builtins.moon +++ b/alv/builtins.moon @@ -458,7 +458,7 @@ Since ~-streams cannot be emtpy, specifying an `initial` value is necessary." value: class extends Op setup: (inputs) => - { event, initial } = any!\match inputs + { event, initial } = (any! + any!)\match inputs assert event\type! == initial\type!, Error 'argument', "~ arguments have to be of the same type" diff --git a/alv/copilot/udp.moon b/alv/copilot/udp.moon index f5deb50..7babd04 100644 --- a/alv/copilot/udp.moon +++ b/alv/copilot/udp.moon @@ -16,6 +16,14 @@ encode_res = => type: tostring @type } +encode_opts = { + exception: (reason, value, state, msg) -> + if reason == "unsupported type" + return "null" + + nil, msg +} + class UDPServer new: (@copilot) => @sock = udp! @@ -32,7 +40,8 @@ class UDPServer @handle msg, client else error: 'invalid message' - @sock\sendto (encode res), ip, port + data = encode res, encode_opts + @sock\sendto data, ip, port handle: (msg, client) => res = { id: msg.id } diff --git a/alv/scope.moon b/alv/scope.moon index 3b35db1..0763cbe 100644 --- a/alv/scope.moon +++ b/alv/scope.moon @@ -51,7 +51,7 @@ class Scope L\trace "found #{val} in #{@}" return val - start, rest = key\match '^(.-)/(.+)' + start, rest = key\match '^([^/]+)/(.+)' if not start return @recurse key |
