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: 
ssaguiar
Streaming Star

Can I set a boolean global variable?

Hi to all.

I am developing a channel for our firm and am having some question (a lot of them).

One of these questions is if I can create a global boolean variable.

I am able to create string global variables this way:

m.global = m.screen.getGlobalNode()
m.global.id = "GlobalNode"
m.global.addField("TOKEN", "string", true)

then, I write to the variable:

m.global.TOKEN = "09834934539"

and read it, in any scene:
token = m.global.TOKEN

This works fine, but it seems that I can't use something to use global boolean variables as:

m.global.addField("AUTHENTICATED", "boolean", true)

then set it:
m.global.AUTHENTICATED = true

and read it:
isauthenticated = m.global.AUTHENTICATED

Is this the correct way or I am wrong?

Thanks for any clue about it.

 

0 Kudos
1 REPLY 1
xoceunder
Roku Guru

Re: Can I set a boolean global variable?

Yes is corect use

 

0 Kudos
Community Upgrade Coming Soon!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12, or you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!