I’m not even sure about that. The scripts have access to the “context”, which contain the outputs of previous modules, in a map whose keys are like “moduleUID.outputName”. Then the outputs are “flattened” (code here) and put as “outputName” as variables in the scope of the script. If there are collisions i.e. multiple outputs with the same name from different modules (does that ever happen?), I believe it’s not handled.
Each module has its own outputs which are described in the module types’ manifests (most of them are here) or in the API (
/rest/module-types). That’s why you sometimes get
event available in the script scope, or sometimes
oldState. It depends on which previously run modules have put their outputs in the context. As for inputs… I don’t even know which module types actually have or use them in openHAB, maybe none!
Edit: I believe the inputs are actually used for “generic” module types i.e. there is a GenericEventTrigger and a GenericEventCondition which will accept an event as an input, and more specialized module types will catch certain types of events and feed them (via their output) to the input of the generic module type… or something… I haven’t fully understood