Jump to content

CallOutputs return value?


Roland
 Share

Recommended Posts

Can self.component:CallOutput( "something" ) give a return value ?

Means that the in-function returns a value that is passed to the CallOutput return

 

Lua1.lua

--------------------------------------------------------------------------------

function Script:func()

local retval = self.component:CallOutput( "something" )

System:Print( retval ) -- prints "Hello" ?

end

 

Lua2.lua

---------------------------------------------------------------------------------

function Script:something()--in

return "Hello"

end

  • Upvote 1

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

it can't at least directly. But you can do it with 3 functions.

 

1. the argument function:

function Script:something()--arg
return "Hello"
end

 

2. the output function:

function Script:Use()
self.component:CallOutputs("Use")
end

 

3. the receiving function:

function Script:Receive(yourvalue)--in
System:Print( yourvalue )
end

 

now just connect the use function with the receive function and drag the something function to the argument point in the flowgraph.

 

 

//edit:

just like in some of my scripts. For example this:

http://www.leadwerks.com/werkspace/page/viewitem?fileid=510080616

Edited by beo6
  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...