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?

my apologies for being late my drone had crashed.
Arducopter version is V4.3.0

is an error which I am getting in messages

This is not the entire output.
I can only see there is an error on 139th line on the messages:

This is getting the value of DR_ENABLE parameters.
That error is about comparing nil to a number, I think that parameter could not be able to initialize.

I am having the same issue. It errors out with the same message all parameter value comparisons (including L139). How do I go about fixing this?

Probably a version issue due to a new Parameter() constructor in the master branch.

Try the version from the Copter-4.3 branch:
ardupilot/copter-deadreckon-home.lua at Copter-4.3 · ArduPilot/ardupilot (

And please do not post the same question more than once.

Ah ok - thanks. I ended up fixing it on my end by adjusting how the parameter value was read.
copter-deadreckon-home.lua (17.5 KB)