Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
btpoole
Level 7

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
RokuMarkn
Level 7

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