# Example script from events section is not working

**URL:** <https://forum.electra.one/t/example-script-from-events-section-is-not-working/2275>\
**Category:** Bug reports\
**Created:** [July 16, 2023, 10:08am UTC](https://forum.electra.one/t/example-script-from-events-section-is-not-working/2275 "2023-07-16T10:08:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mint-Gecko](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Mint-Gecko](https://forum.electra.one/u/Mint-Gecko)\
**Post date:** [July 16, 2023, 10:08am UTC](https://forum.electra.one/t/example-script-from-events-section-is-not-working/2275/1 "2023-07-16T10:08:03Z")

</div>

The example script from the events section ([Preset Lua extension | Electra One Documentation](https://docs.electra.one/developers/luaext.html#example-script-28)) isn’t working:

```lua
function events.onPotTouch(potId, controlId, touched)
  print ("potId: " .. potId)
  print ("controlId: " .. controlId)
  print ("touched: " .. touched)
end

```

The problem is that the touched variable is of type bool and (pardon my c-lang-speak) casting that to a string doesn’t seem as straight-forward since I can see the following error in the log whenever that line is reached:

> error running function ‘onPotTouch’: ctrlv2/slots/p001.lua:427: attempt to concatenate a boolean value (local ‘touched’)

Here’s what I’m doing instead and that works fine:

```auto
print ("touched: " .. (touched and 1 or 0))

```

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [July 16, 2023, 11:52am UTC](https://forum.electra.one/t/example-script-from-events-section-is-not-working/2275/2 "2023-07-16T11:52:07Z")

</div>

The examples page was from an early revision of the Electra OS where the touched parameter was actually a 1 or 0 even though the docs said boolean.

Martin fixed the touched variable in a newer rev of the OS, but the docs were missed.  
I’ve also used code similar to yours (after having it bomb out trying to print the boolean. lol)

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [July 22, 2023, 5:17pm UTC](https://forum.electra.one/t/example-script-from-events-section-is-not-working/2275/3 "2023-07-22T17:17:16Z")

</div>

Fixed the docs to handle the boolean correctly.
