Protect against empty params?
-
Is there a way to protect against a param that isn't sent into a file/macro? If not, can one be added? Or could it default to null?
Example: When using {param.C} in the system file M9000.g, calling M9000 C"test" works, but just calling M9000 errors out.
I'm hoping there is already a way to handle this that just isn't clearly documented. Thanks!
-
-
@oozebot you can use the exists function at the start of the macro to check whether the parameter is present.
-
@dc42 got it working - thanks! It didn't work when I tried but I was using {} around it.. and the documentation only showed that working for variables, so I moved on. For other's reference, the working call looks like:
echo exists( param.C )
-