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_weightsis referencing in the context ofplayerand stores the return value inkeys. -
It runs whichever function
level.custom_random_perk_weightsis referencing in the context ofplayerand 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login