Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jeswin
Visitor

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
Roku Guru

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
Visitor

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
Roku Guru

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
0 Kudos
jeswin
Visitor

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