# Scripts Folder?

**URL:** <https://community.openhab.org/t/scripts-folder/37014>\
**Category:** Scripts & Rules\
**Created:** [December 6, 2017, 2:31am UTC](https://community.openhab.org/t/scripts-folder/37014 "2017-12-06T02:31:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve40](https://community.openhab.org/user_avatar/community.openhab.org/steve40/32/1482_2.png) [@Steve40](https://community.openhab.org/u/Steve40)\
**Post date:** [December 6, 2017, 2:31am UTC](https://community.openhab.org/t/scripts-folder/37014/1 "2017-12-06T02:31:21Z")

</div>

Evening, all!

In openHab 1.x there was a scripts folder where you could place bits of code for reuse, kinda like a function/subroutine, except (if I recall correctly) it was relatively useless since you couldn’t pass variables to the scripts. I see that the scripts folder is still there in openHab 2.x. Does it still work the same as in 1.x, or can you pass variables to the scripts now?

Thanks!

---

<div class="post-metadata">

**Author:** ![Steve40](https://community.openhab.org/user_avatar/community.openhab.org/steve40/32/1482_2.png) [@Steve40](https://community.openhab.org/u/Steve40)\
**Post date:** [December 6, 2017, 3:19am UTC](https://community.openhab.org/t/scripts-folder/37014/2 "2017-12-06T03:19:52Z")

</div>

Hmmm… Looking further with a few different keywords, it sounds like lambda expressions might be what I need, correct? I’ll dig into this further…

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [December 6, 2017, 2:05pm UTC](https://community.openhab.org/t/scripts-folder/37014/3 "2017-12-06T14:05:00Z")

</div>

> [@Steve40](#):
>
> Does it still work the same as in 1.x, or can you pass variables to the scripts now?

It still works the same.

> [@Steve40](#):
>
> Looking further with a few different keywords, it sounds like lambda expressions might be what I need, correct?

Depends on what you are trying to accomplish.

> [@Reusable Functions: A simple lambda example with copious notes](https://community.openhab.org/t/reusable-functions-a-simple-lambda-example-with-copious-notes/15888):
>
> Major Edit: Rewrote with the cleaner OH 2.3 syntax. The example lambda on the OH 1 wiki is overly complex and as written will not work in OH 2. This quick example will show a super simple lambda example with copious notes. Here is the code without comments. It takes in an Item, logs it’s state and returns a slightly modified version of the String logged. val log= [GenericItem s | logInfo("lambda", s.state.toString) s.state.toString + " logged"] rule "Call Lambda" when // some t…

---

<div class="post-metadata">

**Author:** ![Steve40](https://community.openhab.org/user_avatar/community.openhab.org/steve40/32/1482_2.png) [@Steve40](https://community.openhab.org/u/Steve40)\
**Post date:** [December 8, 2017, 5:50pm UTC](https://community.openhab.org/t/scripts-folder/37014/4 "2017-12-08T17:50:25Z")

</div>

That’s exactly the info that I needed! Thanks!
