I have a function that is called from several places in LUA scripts, and I want to add a parameter to it.
In stead of going through all scripts and modify the call, I would like to handle this in the function, and assign a default value if the parameter is missing.
How can I check this? In other words, how can I test for a nil value?
recognize missing argument
Moderator: leecollings
-
- Posts: 749
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: recognize missing argument
Never mind, I already had it but missed a small typo in my code....
Simply compare the input parameter to nil and "" does the trick: if it is missing or empty I can assign the default.

Simply compare the input parameter to nil and "" does the trick: if it is missing or empty I can assign the default.
Hans
Who is online
Users browsing this forum: No registered users and 1 guest