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: 

Global or persistent variables?

I want to fetch an initial config XML, and store those settings for use later. I don't see that brightscript has any sort of concept of global variables, or an easy way to access some long term stored variable. Ideally it'd be some config object I can create, and reference from anywhere. What's the best way to do something like this?
0 Kudos
3 REPLIES 3
RokuChris
Roku Employee
Roku Employee

Re: Global or persistent variables?

You can pass your config data around as parameters to those functions that need to access it.

Or store it as a member of the global m http://sdkdocs.roku.com/display/RokuSDK ... hispointer

Then, you can call GetGlobalAA() from within other objects to access the global m http://sdkdocs.roku.com/display/RokuSDK ... AAAsObject
0 Kudos

Re: Global or persistent variables?

I'd really like to have something like

config = setupConfig();

config.add('debug',1');

if (config.get('debug') > 0) then
'do something
endif


I don't see how I'd store something in the GlobalAA though.
0 Kudos
RokuMarkn
Visitor

Re: Global or persistent variables?

Same as you store into any other AA.


config = GetGlobalAA()
config["debug"] = 1

if config["debug"] = 1 then
....
end if


--Mark
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.