A script can be an option of a contextual menu attached to an Active View graphic object. This can allow you to launch a script on a user demand.
In the screen shot below you can see many items defined for the contextual menu. Each item lauches a different script or the same script with different parameters
The object with it contextual menu
The syntax for the script action is:
filename.lua ip_adresse index oid
When a script is lauched from the menu a windows display the result of the script
Close the windows to continue