Imitating a rangefinder and setting the distance manually

Hi,

Is it possible using Lua script to set a “measured distance” of a rangefinder, that doesn’t exist?

I want to link an RC input channel, from PWM to a distance range ( in meters ), to a “measured” distance from a rangefinder that the autopilot thinks exists, so that i can use the mavlink messages for another application that reads the rangefinder data.