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: 
btpoole
Channel Surfer

Global Variable Not Available In Function

Why would be that a "m" variable would be available in one function and not another? I set a variable as global during a load sequence such as:


m.guide=guide


Later in code I have a large function that calls the m.guide and works perfect. I decide to cut the function up into smaller functions for debugging and modifications. I copied this section of the larger function and pasted into the smaller function. Nothing else changed, but when I call the smaller function I get error that variable is not Dim'd. Under the RunUserInterface I have declared the variable and populated it. Like I said, it is available in the original function. Just wondering if there is anything in general that may cause this.
Thanks
0 Kudos
1 REPLY 1
RokuMarkn
Visitor

Re: Global Variable Not Available In Function

If you call a function through an AA, "m" in that function refers to the AA, not to the global m. In such a function you can use GetGlobalAA to get the global m.

--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.