Lua library code...does Vera (UI5) cache the contents? If so, how to force reload on changes?

I’m trying to create a simple Lua library file that toggles locks, lights. The (currently) only function takes one parameter, a device number. Uploaded the Lua file, and attempted to call it from test code window. I had tried this also with another simple module and function, and it worked. With this latest attempt, I get a failed message in the test window. Have gutted the module so the called function is empty…there’s nothing to fail. Test code window still says it fails. If I pull the empty function into the test code window and call that, of course it works.

So is Vera caching these Lua files? I’ve tried reloading Luup, and it seems to make no difference. Is there some special trick to declaring functions that take parameters? Or some special trick to get Vera to use the new version of a code module?

Puzzled.

–Richard

If you are loading the file with a require statement, and the module loads successfully, then, yes, another call to require for the same file will do nothing.

You would have to explicitly purge it from the loaded packages table.

This is standard Lua behaviour.

And is reloading the Luup engine not sufficient?

–Richard

Yes, it should be. Anything that makes the specific Lua instance go away should take all those tables with it.

OK. Making headway. Now just have to figure out what Vera hates about this code snippet:

DL_SID = “urn:micasaverde-com:serviceId:DoorLock1”
device = 110
newstatus = “1”
luup.call_action(DL_SID,“SetTarget”, {newTargetValue = newstatus}, device)

Device 110 is an instance of the Garage Door app under UI5. The equivalent HTTP call works fine. I’ve looked at a lot of examples in the forum, and don’t see what I’m screwing up…but the above always fails in the test code window.

Mangled quotes. Retype all the quotes in the code window.

Thanks a ton. What’s weird is that I had written the original file in Emacs…although I did do some copy/paste from what must have been mangled versions in forum examples. But have not had Emacs produce mangled quotes before. Must have inherited them from a copy/paste.

–Richard