# Lua in response \[Solved\]

**URL:** <https://forum.electra.one/t/lua-in-response-solved/3925>\
**Category:** General discussion\
**Created:** [September 16, 2025, 8:17pm UTC](https://forum.electra.one/t/lua-in-response-solved/3925 "2025-09-16T20:17:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelhaefliger](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@michaelhaefliger](https://forum.electra.one/u/michaelhaefliger)\
**Post date:** [September 16, 2025, 8:17pm UTC](https://forum.electra.one/t/lua-in-response-solved/3925/1 "2025-09-16T20:17:23Z")

</div>

Is there a way to integrate a Lua function into the SysEx Editor when handling a response? Or am I doing something wrong here? The following example didn’t work for me:

```lua
deviceId = 1
device = devices.get(deviceId)
devPort = device:getPort()
channel = device:getChannel()

function sysExChannel()
    return channel - 1
end

```

 ![LuaResponse_1](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/b/b83a45cbf1ca597ca32d7e92f4603ae3188bb2bb.png)

 ![LuaResponse_4](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/c/ca8db402fb8b165794df56befad9da5fc44152aa.png)

 ![LuaResponse_3](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/b/b2f2a42e949f417b2110fbcfcb276ad996d0bb07.png)

 ![LuaResponse_2](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/4/480a0a22255d94d311c1e78bca3fd0df2bd43a57.png)

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [September 17, 2025, 10:41am UTC](https://forum.electra.one/t/lua-in-response-solved/3925/2 "2025-09-17T10:41:13Z")

</div>

I think there is still a hick-up in the listening mode: if you add a function to a response header, that function is not invoked when using the editor’s listening mode. Hence, a received SysEx is not matched against the response header and thus not parsed.

My way around: during development, you temporarily replace the function in the response header with the hardcoded channel you need, so the parsing works. Once all parsing is done and tested, then you insert the function again, upload the preset in the E1 and test it out directly on the E1.

---

<div class="post-metadata">

**Author:** ![michaelhaefliger](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@michaelhaefliger](https://forum.electra.one/u/michaelhaefliger)\
**Post date:** [September 17, 2025, 3:13pm UTC](https://forum.electra.one/t/lua-in-response-solved/3925/3 "2025-09-17T15:13:01Z")

</div>

Awesome, thanks for the hint. I thought you’d surely have an alternative ready.
