Page 1 of 1

recognize missing argument

Posted: Thursday 07 July 2022 12:27
by manjh
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?

Re: recognize missing argument

Posted: Thursday 07 July 2022 12:42
by manjh
Never mind, I already had it but missed a small typo in my code.... :mrgreen:

Simply compare the input parameter to nil and "" does the trick: if it is missing or empty I can assign the default.