Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jeswin
Level 7

Is it possible to return string from Task?

Hi,

In scene graph Task Component

can we return string value instead of content node?

<interface>
    <field id = "ProcessType" type = "string" />
    <field id = "content" type = "node" />
    <field id="isValid" type="boolean" />
  </interface>


Can i return ProcessType value to Scene?
0 Kudos
4 REPLIES 4
EnTerr
Level 11

Re: Is it possible to return string from Task?

Absolutely!
You can return any type that RSG supports - string, [ ], { }... any JSON sausage you can think of, plus a few more.
0 Kudos
jeswin
Level 7

Re: Is it possible to return string from Task?

Thank you for your reply.

Can you just give an example how you will get the string value from Task component to Scene component.

I accept we can set the value for interface, but how will you return string from a function in Task Component.

For example:

m.taskContent = createObject("roSGNode","contentReader")
m.taskContent.FunctionName="getProcessType"
m.taskContent.Control="RUN"

processType =""
processType = m.taskContent.ProcessType


is it possible like this? or in any other way?
0 Kudos
belltown
Level 9

Re: Is it possible to return string from Task?

Use this code in your Scene component:

m.taskContent.ObserveField("ProcessType", "onProcessType")

sub onProcessType()
    print "ProcessType: "; m.taskContent.ProcessType
end sub
https://github.com/belltown/
0 Kudos
jeswin
Level 7

Re: Is it possible to return string from Task?

Yea i am doing like this only, it is working fine mate.
Thanks for your reply
0 Kudos