func init // adds using namespace sys.add_use('System') // initialize instance if(linked("Result") and linked("doRound")) sys.add_var(this.name, 'dynamic') end // initialize type of the number this.type = (this.props("Type").value) ? 108 : 7 end func doRound(value) if(linked('Result')) blk.println(this.codename, ' = ', this.make_result(value), ';') event('onResult', sub(this.codename, this.type)) else event('onResult', this.make_result(value)) end end func make_result(value) res = 'Math.Round(' + sys.to_type(d("Value"), this.type) + ', ' + d("Digits") + (isdef("Mode") ? '' : (', MidpointRounding.' + this.props("Mode").value)) + ')' return(sub(res, this.type)) end func Result if(linked("doRound")) return(sub(this.codename, this.type)) else return(make_result()) end end