Syntax Question: What this specific code do?
-
I was looking at the get_weighted_random_perk function in _zm_perk_random (Line 503), and I saw this code:
keys = player [[ level.custom_random_perk_weights ]]();
I've never seen this kind of syntax for other coding languages. What does this do?
-
It runs whichever function
level.custom_random_perk_weights
is referencing in the context ofplayer
and stores the return value inkeys
. -
Xerxes Thanks for the response. I found level.custom_random_perk_weights in include_perks_in_random_rotation, and it looks like this:
level.custom_random_perk_weights = ::tomb_random_perk_weights;
Is this just a simple reference to a function that can be called via custom_random_perk_weights later, or does tomb_random_perk_weights get called and referenced when this code is run?
-
That is where the reference is set and not something like in an event driven system where you add yourself to the listeners of an event.