# LUA functions question

**URL:** <https://discourse.cataclysmdda.org/t/lua-functions-question/12558>\
**Category:** The Lab\
**Created:** [September 20, 2016, 3:25am UTC](https://discourse.cataclysmdda.org/t/lua-functions-question/12558 "2016-09-20T03:25:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucien](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucien](https://discourse.cataclysmdda.org/u/Lucien)\
**Post date:** [September 20, 2016, 3:25am UTC](https://discourse.cataclysmdda.org/t/lua-functions-question/12558/1 "2016-09-20T03:25:52Z")

</div>

Hello, I’m real new to modding on this, but I am putting together a mod and I am using some LUA functions, or trying to.

Most things are working great, I have custom iuse function working.  
However, when I use the item, I want it to place a buff on the player for a few seconds.

For example, if I use `player:add_effect("dazed", 10)` or any other effect I get a: bad argument #1 to ‘add\_effect’ (userdata expected, got string)

I checked the class\_definitions.lua and it says that the function is exposed. But, am I maybe on a build that doesn’t have it working yet? I am running 0.C-18364-g5a5f641 and the LUA engine seems to see the function. I have tried this both in the mod code and directly from the LUA command line in game.

Am I missing something, or is this not entirely working yet?

Thanks for any info you could offer.

---

<div class="post-metadata">

**Author:** ![Lucien](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@Lucien](https://discourse.cataclysmdda.org/u/Lucien)\
**Post date:** [September 20, 2016, 10:04pm UTC](https://discourse.cataclysmdda.org/t/lua-functions-question/12558/2 "2016-09-20T22:04:57Z")

</div>

Aha, I figured it out. According to PR 14920, you have to wrap the effect\_id in a efftype\_id(“string”) to make it work.

Testing a `player:add_effect(efftype_id("dazed"),10)` gives the correct result now.
