• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Splice Function

sincla

Well-known member
Sorry for all these questions, I'm only asking about things that I can't find on the wiki.

What does the splice function do and what are the parameters passed into it?

splice(x,y,z), what are x, y, and z?

Thanks.
 
So normally Splice() is used in languages like JavaScript to splice apart a long string (ie URL) into tokens by a specific value. So for a URL you normally slice it apart by its "/" to get each piece as a token. Anyways it appears that HL splice does the exact opposite.

So splice() here puts strings together by a specific value.
Code:
      ~append any special details for this weapon
      special = splice(special,field[wpSpecial].text,", ")
So above would put the existing text in "special" together with the text in field[wpSpecial].text adding ", " in between.

So if Special had "shadow" and field[wpSpecial].text had "chemosh" then special at the end would have "shadow, chemosh" in it. :)
 
Thanks. Yeah that's kind of an odd use of the word splice. I guess what's being "spliced" is the middle character between two strings.
 
Back
Top