Both sides previous revision Previous revision | Next revision Both sides next revision | ||
hpl2:amnesia:script_language_reference_and_guide:funcions_-_part_1 [2012/12/30 01:58] thegreatcthulhu |
hpl2:amnesia:script_language_reference_and_guide:funcions_-_part_1 [2012/12/30 02:00] thegreatcthulhu |
||
---|---|---|---|
Line 109: | Line 109: | ||
If you visit the [[hpl2:amnesia:script_functions|Engine Scripts]] page, you'll see that all the predefined functions over there are listed as function declarations. | If you visit the [[hpl2:amnesia:script_functions|Engine Scripts]] page, you'll see that all the predefined functions over there are listed as function declarations. | ||
- | |||
- | <note tip> | ||
- | **The Scope of Function Parameters**\\ | ||
- | Function parameters are associated with the function body, as if they were variables declared inside it. Thus, function parameters - the variables in the declaration - are local in scope, that is, they are visible (usable) only from within the function itself. | ||
- | |||
- | When variables are used in a //function call// as input parameters, these input variables, and their names, are external to the function (and are generally not visible to it); it is //the data// they contain that gets passed in, not their names. The data values, upon entering the function they were passed to, //become assigned// to the corresponding names in the parameter list. | ||
- | </note> | ||
=== Calling a Function === | === Calling a Function === | ||
Line 160: | Line 153: | ||
float calculationResult = Calculate(min, max, RandFloat(0.0f, 1.0f)); | float calculationResult = Calculate(min, max, RandFloat(0.0f, 1.0f)); | ||
</code> | </code> | ||
+ | |||
+ | <note tip> | ||
+ | **The Scope of Function Parameters** | ||
+ | |||
+ | Function parameters are associated with the function body, as if they were variables declared inside it. Thus, function parameters - the variables in the declaration - are local in scope, that is, they are visible (usable) only from within the function itself. | ||
+ | |||
+ | When variables are used in a //function call// as input parameters, these input variables, and their names, are external to the function (and are generally not visible to it); it is //the data// they contain that gets passed in, not their names. The data values, upon entering the function they were passed to, //become assigned// to the corresponding names in the parameter list. | ||
+ | </note> | ||
=== Where to Make the Call From? === | === Where to Make the Call From? === |