0
votes

I want to pass the output of one function as a parameter of another function without relying on temp-variables. The ways it tried it, it either did not recognize it as a function, and thus outputed 1, or was just empty. Expected output for the example below should be a1. I tried it with msgbox % functionb(% functiona(),1); msgbox % functionb(functiona.call(),1) and msgbox % functionb(func("functiona"),1). Is there a way to do it?

msgbox % functionb(functiona.call(),1)

functiona() {
return a
}

functionb(Var1, Var2) {
output := Var1 Var2
return output
}

2

2 Answers

2
votes

I think the proper way would be something like this:

msgbox % functionb(functiona(),1)

functiona() {
    return "a"
}

functionb(Var1, Var2) {
    return, Var1 Var2
}

0
votes

amsgbox % functionb(% functiona(),1)
would be trying to force an expression, while already in expression syntax. So that's the wrong part there.

msgbox % functionb(functiona.call(),1)
would be trying to call a function object, but "functiona" is not a function object, it's just the name of a function.

msgbox % functionb(func("functiona"),1)
would be creating a function object, not right either.


Second problem is return a.
You're trying to return the value of a variable named a, as opposed to returning character "a".

The correct way would be:

MsgBox, % functionb(functiona, 1)

functiona() 
{
    return "a"
}

functionb(Var1, Var2) 
{
    output := Var1 Var2
    return output
}