• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
action arguments not being checked at startup
The segfault when the rule is executed has indeed been solved, but unfortunately the validation bug has not been solved by he fix.

Putting one or more spaces after the closing parenthesis of a function at the end of a rule is still causing a segfault. The same as I posted before.
I found that issue as well Smile
Good work!

I'll do my best to test it tomorrow.
I can confirm that the validation works OK now.
(07-01-2018, 08:45 PM)curlymo Wrote: PS. the write action looks nice. Great to see you using Lua functionality in a pilight action. Also check the pilight.common.explode function instead of your split implementation.

I tried to replace the local split function with pilight.common.explode, but the behaviour of both functions is different.

E.g. a string like "//foo//bar/" is resulting in an array with 6 entries if the split function is being used ("", "", "foo", "", "bar", "")  and an array with just 2 entries wnen using pilight.common.explode ("foo", "bar")

So pilight.common.explode is handling duplicate delimiters as one and ignores leading and trailing delimiters. That may be intentional, but using the split function I can simply check for leading, trailing or duplicate delimiters to validate the delimited string.

So in this case I prefer using the local split function.
Why do you want ("", "", "foo", "", "bar", "") instead of ("foo", "bar")?
Because I am using the result of the split not only to separate the directory name from the file name, but, as I said, also to verify the validity of the path. Looking at the empty elements and their position in the string I can simply see if the path is valid and, if not, give an appropriate error message.

I could ofc. achieve the same with your explode function and additional code checking the path's validity. So then we will in fact be analyzing the path twice, once for validation and once more to split directory- and file name. With the split function we can do it in one go.
Ok, i understand. I love it that lua gives us that possibility.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Enhanced lua label action Niek 5 1,041 07-04-2018, 05:28 PM
Last Post: curlymo
  IP addresses not accepted as option value for an action Niek 4 1,011 06-25-2018, 01:59 PM
Last Post: Niek

Forum Jump:

Browsing: 1 Guest(s)