Guest User

Untitled

a guest
Jul 27th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.12 KB | None | 0 0
  1. <block>
  2.     <head>
  3.         <title>math.add</title>
  4.         <inputs>
  5.             int first, int second, int more ...
  6.         </inputs>  
  7.         <outputs>
  8.             int total
  9.         </outputs>
  10.     </head>
  11.     <display>
  12.         Add up the provided integers
  13.     </display>
  14.     <action>
  15.         <script type="text/javascript" interface="BlueprinterModularJS">
  16.             add = function() {                
  17.                 this.db = {            
  18.                     inputs: ["int first","int second"],      
  19.                     outputs: {"int total":"adder"},
  20.                 },                        
  21.                 this.adder = function() {
  22.                    
  23.                     this.total = 0;
  24.                    
  25.                     for ( var i in this.db.__inputs ) {                          
  26.                         this.total += this.db.inputs(i);
  27.                     }
  28.                     this.db.outputs[0] = this.total;
  29.                     this.db.log( "Executed: " + this.total );
  30.                     return this.total;
  31.                 }
  32.  
  33.             }
  34.         </script>
  35.     </action>
  36. </block>
Advertisement
Add Comment
Please, Sign In to add comment