[PLUGIN] rex_Function2

Post your completed addons to share with the community

Post » Thu Jul 21, 2016 4:28 am

@rexrainbow
I understand now, thanks. So.. In my example, comparing to the official plugin, there's extra 2 lines of code when calling the function and 2 extra lines of code when defining the function, but that's ok
Thank you for clearing that out.
P.S. "declare parameter" and "Set parameter" should be done behind the scene, since I will declare a parameter ONLY if will use it in the function defininition
I mean, if I use a string instead of number for the parameter index it should be acting like the example you provided, without me adding extra lines of code.
Something similar to "function overload"
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Thu Jul 21, 2016 4:48 am

@Cipriux

"declare parameter" has 3 effects
1. It maps the string index to index index. The first defined parameter will map to index 0.
In your case, you also could call function by index parameter (touch.X, touch.Y). Thus this rex_function2 plugin is compatible with official function plugin.

2. It could give a default value if this parameter was not assigned. You could define a lot of input parameters but only pass some of them.

3. Moreover, it could check the type of parameter value.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Previous

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests