scottchiefbaker
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2013
02:04 PM
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?
3 REPLIES 3


Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2013
02:20 PM
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
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
scottchiefbaker
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2013
02:50 PM
Re: Global or persistent variables?
I'd really like to have something like
I don't see how I'd store something in the GlobalAA though.
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.

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2013
03:24 PM
Re: Global or persistent variables?
Same as you store into any other AA.
--Mark
config = GetGlobalAA()
config["debug"] = 1
if config["debug"] = 1 then
....
end if
--Mark