Deadreckon home lua script not working

Hey folks,
I were testing this lua script to add more functionality to my copter and getting this error:
attempt to compare number with nil" in line number 139.
Please guide me how to resolve this error as I am new to lua scripting.

Provide the full output.
Which version of ArduPilot you’re using?