mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
32 lines
767 B
Plaintext
32 lines
767 B
Plaintext
module Ret
|
|
|
|
import Service from "service.aqua"
|
|
|
|
use "error.aqua"
|
|
export GetStr, multiReturnFunc, Service as S
|
|
|
|
service GetStr("multiret-test"):
|
|
retStr: string -> string
|
|
|
|
service GetNum("multiret-num"):
|
|
retNum: -> u8
|
|
|
|
const SOME_NUM = 5
|
|
const SOME_STR = "some-str"
|
|
|
|
func tupleFunc() -> string, u8:
|
|
str <- GetStr.retStr(SOME_STR)
|
|
n <- GetNum.retNum()
|
|
Err.Peer.is_connected("Connected?")
|
|
<- str, n
|
|
|
|
func multiReturnFunc(somethingToReturn: []u8, smthOption: ?string) -> []string, u8, string, []u8, ?string, u8:
|
|
res: *string
|
|
res <- GetStr.retStr(SOME_STR)
|
|
try:
|
|
res <- GetStr.retStr("random-str")
|
|
catch e:
|
|
GetStr.retStr(e.msg)
|
|
res, tNum <- tupleFunc()
|
|
<- res, 5, SOME_STR, somethingToReturn, smthOption, tNum
|