git.s-ol.nu alive / c8728dc
udp: reply with tag/module in msg s-ol 1 year, 3 months ago
1 changed file(s) with 7 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
3434 switch msg.type
3535 when 'tick'
3636 res.tick = @copilot.T
37 -- when 'sub'
38 -- @subs[client] = true
39 -- res.ok = true
40 -- when 'unsub'
41 -- @subs[client] = nil
42 -- res.ok = true
4337 when 'modules'
4438 res.modules = [name for name in pairs @copilot.last_modules]
4539 when 'info'
46 mod = @copilot.last_modules[msg.module or '__root']
40 res.tag = msg.tag
41 res.module = msg.module or '__root'
42 mod = @copilot.last_modules[res.module]
4743 builtin = mod.registry\last msg.tag
4844 if builtin and builtin.__class.__name ~= 'DummyReg'
4945 res.head_meta = builtin.head.meta
5551 else
5652 res.error = 'not_registered'
5753 when 'state'
58 mod = @copilot.last_modules[msg.module or '__root']
54 res.tag = msg.tag
55 res.module = msg.module or '__root'
56 mod = @copilot.last_modules[res.module]
5957 builtin = mod.registry\last msg.tag
6058 if builtin and builtin.__class.__name ~= 'DummyReg'
6159 res.value = encode_res builtin.node.result, @copilot
62 if op = builtin.op
63 res.state = op.state
60 res.state = if builtin.op then builtin.op.state
6461 else
6562 res.error = 'not_registered'
6663 else