First, I'm assuming by "remote shooting" you mean shoot and save the file directly over PTP, like the chdkptp "rs" command. If you just mean trigger a shot using PTP, the answer is different.
The simple way to remoteshoot from chdkptp lua is just to execute the remoteshoot cli command, like
cli:execute('rs')
You can use Lua string.format or concatenation set options, like
cli:execute(string.format('rs -tv=%d -svm=%d',some_tv_val,some_iso_val))
cli:execute catches any errors, and returns a status and possibly a message, which you should do something with if you want to know when things go wrong. You can use cli:print_status to do this, like
cli:print_status(cli:execute('rs'))
The multilapse.lua script at
https://github.com/alesanmanoweb/multilapse-CHDK is an example of a script that uses this approach.
If you want to code the lower level bits yourself, it's rather more complicated. You can look at the code for the remoteshoot command in cli.lua, and the rsint command in rsint.lua. Both of these rely on camera side code in rlibs.lua.
rsint might be the more applicable to your case. Regular remoteshoot is intended to shoot one or more shots with settings determined in advance. rsint runs a camera side script that listens for messages which tell it to shoot, or execute other code.
BTW, you've posted related questions in quite a few different topics. Many forums encourage finding exactly the right sub-forum and topic for each post, but here we often find it works better if you just use one thread for everything related to your project. The discussion wander, but it's easier to follow. Traffic here is low enough the regulars will likely see post.