Reactor not doing run Lua

reactor for some reason wont run Lua: dofile("/etc/cmh-ludl/MySDc_Scene_KitchenMotion")
but when i put it in test lua code it does run it

Do you need to specify the .lua extension explicitly?

i think i found the problem, i defined some variables globally but reactor runs in a different sandbox that the startup lua i may just use run scene instead,122435.msg445855.html#msg445855

how can i create a module to do i list of device and device numbers to use in reactor

Vera/Luup sandboxes plugins separate from the environment used by startup Lua and scenes. You can put your code into a module, and use “require” to load your module in your Reactor Run Lua actions. You can also load your module in your startup Lua (it will still not be shared in memory/environment, but at least it will be identical code and usable in the same way in both places).

Most modules on Vera are built using the style under “The old way of creating modules” heading on this page:

You can use the newer style described at the top of the page as well, if you wish.

Both styles require that you understand Lua scopes (where declared (and undeclared) variables are visible and where they are not). The “old way” seems easier for most people who are new to Lua to grasp and not make quite as many errors as the second method mentioned above.

EDIT: BTW, the post in the old forums you linked above describes this procedure as well. That post lives here in the new forums: Undeclared/Uninitialized errors in LUA Activities

1 Like

I used the fact that vera runs plugins and scenes in different sanboxes to stabilize my unit a bit. some scenes run different and concurrent to each other
some rectors actually call a scene from vera
like so
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="131"},0)

other scene run locally in reactor

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules