Change throttle max with a lua script

Hello guys,
recently I am working on a lua script to change some Pixhawk parmater through the radio command.
What I want for example is to change MOT_THR_MAX from 50% to 80% in manual mode by changing the position of my joystick “RC7 input”
But I can’t find a document that manages to change the pixhawk settings
There is someone who can guide me please.
Thanks in advance.

To set a parameter, take a look at this example.
To read a PWM value, take a look at this example.

Thank you. It works fine now !!