func init // adds using namespace sys.add_use('System') // initialize instance if(linked("Result") and linked("doMin")) sys.add_var(this.name, 'dynamic') end // initialize type of the numbers this.type = this.get_type(this.props("Type").value) end func get_type(t) if(t == 0) return(7) elseif(t == 1) return(108) elseif(t == 2) return(1) elseif(t == 3) return(105) elseif(t == 4) return(107) end end func doMin(data) if(linked('Result')) blk.println(this.codename, ' = ', this.make_result(data), ';') event('onResult', sub(this.codename, this.type)) else event('onResult', this.make_result(data)) end end func make_result(data) res = 'Math.Min(' + sys.to_type(d("A"), this.type) + ', ' + sys.to_type(d("B"), this.type) + ')' return(sub(res, this.type)) end func Result if(linked("doMin")) return(sub(this.codename, this.type)) else return(make_result()) end end