如何将多个字符串从脚本返回到booggie 2中的规则序列?

brg*_*rgn 3 python booggie

这是在booggie 2中使用python脚本特有的问题.

我想将多个字符串返回到序列并将它们存储在变量中.

该脚本应如下所示:

def getConfiguration(config_id):
    """ Signature:  getConfiguration(int): string, string"""

    return "string_1", "string_2"
Run Code Online (Sandbox Code Playgroud)

按顺序我想要这个:

(param_1, param_2) = getConfiguration(1)
Run Code Online (Sandbox Code Playgroud)

请注意:booggie项目不再存在,但导致了Soley Studio的开发,它涵盖了相同的功能.

Blu*_*uuu 7

booggie 2中的脚本仅限于一个返回值.但是你可以返回一个包含字符串的数组.可悲的是,Python数组与GrGen数组不同,所以我们需要先将它们转换.

所以你的例子看起来像这样:

def getConfiguration(config_id):
    """ Signature:  getConfiguration(int): array<string>"""

    #TypeHelper in booggie 2 contains conversion methods from Python to GrGen types
    return TypeHelper.ToSeqArray(["string_1", "string_2"])
Run Code Online (Sandbox Code Playgroud)