func init // gets type of an array if(isdef("ResultType")) this.type = 'dynamic' else this.type = code(this.props("ResultType").value.props("TypeName").value) if(this.type == 'Object undefined') error(this.name + ' - property ' + this.props("ResultType").name + ' does not defined') this.type = 'dynamic' end end // initialize instance this.typecode = sys.type_code(this.type) if(linked("Result") and linked("doRead")) sys.add_var(this.name, (this.typecode > 0) ? this.typecode : this.type) end end func make_result(data) field = replace(this.props("Name").value, '\\"', '"') r = '' + (isdef('Typed') ? '' : '(' + this.type + ')') + d("Object") + (len(field) ? '.' + code(field) : '') return(sub(r, this.typecode)) end func doRead(data) if(linked("Result")) blk.println(this.codename, ' = ', make_result(data), ';') event("onRead", sub(this.codename, this.typecode)) else event("onRead", make_result(data)) end end func Result if(linked("doRead")) return(sub(this.codename, this.typecode)) else return(make_result()) end end