Author Topic: BoolexprUtils  (Read 2851 times)

Rating
Average Score
« Created: November 08, 2016, 08:54:43 AM by moyack »

  • Newbie - level 1
  • *
  • Posts: 13
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • Reputation: 0
  • Just a Man in the Back
    • View Profile
BoolexprUtils
« on: November 08, 2016, 08:04:14 AM »
True and False BooleanExpressions

Credits goes to Vexorian for the first idea.


Vjass version
Code: jass  [Select]
  1. library BoolexprUtils
  2.  
  3.     globals
  4.         boolexpr BOOLEXPR_TRUE
  5.         boolexpr BOOLEXPR_FALSE
  6.     endglobals
  7.  
  8.     private module Init
  9.  
  10.         private static method filterTrue takes nothing returns boolean
  11.             return true
  12.         endmethod
  13.  
  14.         private static method filterFalse takes nothing returns boolean
  15.             return false
  16.         endmethod
  17.  
  18.         private static method onInit takes nothing returns nothing
  19.             set BOOLEXPR_TRUE = Filter(function thistype.filterTrue)
  20.             set BOOLEXPR_TRUE = Filter(function thistype.filterFalse)
  21.         endmethod
  22.  
  23.     endmodule
  24.  
  25.     private struct S extends array
  26.         implement Init
  27.     endstruct
  28.  
  29. endlibrary

Zinc version
Code: jass  [Select]
  1. //! zinc
  2. library BoolexprUtils {
  3.  
  4.     public boolexpr BOOLEXPR_TRUE, BOOLEXPR_FALSE;
  5.  
  6.     module Init {
  7.         static method onInit() {
  8.             BOOLEXPR_TRUE = Filter(function() -> boolean {return true;});
  9.             BOOLEXPR_FALSE = Filter(function() -> boolean {return false;});
  10.         }
  11.     }
  12.  
  13.     struct S extends array {module Init;}
  14.  
  15. }
  16. //! endzinc

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 985
  • WC3 Models: 5
  • WC3 Tutorials: 11
  • WC3 Tools: 10
  • WC3 Maps: 11
  • WC3 Skins: 6
  • WC3 Icons: 2
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Re: BoolexprUtils
« Reply #1 on: November 08, 2016, 09:15:32 AM »
simple, but effective ;)

Good job!


We can give you full hosting for your projects. Not only a forum, a complete page!!.

A custom altered melee map where you can play Naga and Demons. Featuring a nice additions in features and game style. Check it out!!
Save your important files fast and easy

 

Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!