• 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
#11
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.
 
Reply
#12
I found that issue as well Smile
 
Reply
#13
Good work!

I'll do my best to test it tomorrow.
 
Reply
#14
I can confirm that the validation works OK now.
 
Reply
#15
(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.
 
Reply
#16
Why do you want ("", "", "foo", "", "bar", "") instead of ("foo", "bar")?
 
Reply
#17
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.
 
Reply
#18
Ok, i understand. I love it that lua gives us that possibility.
 
Reply
  


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

Forum Jump:


Browsing: 1 Guest(s)