How to pass Args

What is the proper way to pass/read args in a piston?
I created a global and set the Args option in Execute Piston command to load this variable but the global never changes when I read it in the called piston.
If I set the global first and then execute the piston it works but that's not really passing an argument to a subroutine/function in the classical sense.

Here is one example

Sender:

Receiver:

Here is another

Sender

Receiver:

Screenshot 2023-01-26 at 9.17.31 PM

1 Like

Great examples, thanks.
I'll hit the piston bricks tomorrow and try to fancy up my 2 subs.

On a side note (related to me making subroutines for common code) I often find myself wandering all over piston land when I use Globals or Executes in multiple places. There is no Print option for pistons so is there a way to extract the backup into a Word doc so the codebase is searchable?

What should the Log info {$args.name} produce? I'm getting a null.

I did not pass anything called name, so that is correct.

1 Like

I was trying everything I could think of to pass a device until I remembered this nugget you posted for me a while back.
Didn't know I needed a [0] for the device name. I kept getting a string and wondering how to convert that to a device name with a function, something like bool() for devices.
All good now! :slight_smile:

1 Like