Need Help screen getting Invalid value for left-side of expression error

Running the debugger on Visual Studio Code on a Roku channel I am creating and I am getting an Invalid value for left-side of expression error pointing at: screen = CreateObject(“roSGScreen”)

Here is the debugger output and main.brs code. Very new to this and would appreciate some help.

Output:

04-13 22:15:03.483 [scrpt.ctx.run.enter] UI: Entering ‘NationExtremeWrestling’, id ‘dev’
------ Running dev ‘NationExtremeWrestling’ main ------
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.
Current Function:
001: sub Main()
002: m.top.global = {
003: api_key: “AIzaSyCn9WZzbJdT7XsQOuLYv-kQNmCFbUQ2jQI”,
004:* youTubeApiBaseUrl: “https://www.googleapis.com/youtube/v3/
005: }
006:
007: screen = CreateObject(“roSGScreen”)
008: m.port = CreateObject(“roMessagePort”)
Source Digest(s):
pkg: dev 0.0.0 b434e374 NationExtremeWrestling
Invalid value for left-side of expression. (runtime error &he4) in pkg:/source/main.brs(4)
Backtrace:
#0 Function main() As Void
file/line: pkg:/source/main.brs(7)
Local Variables:
global Interface:ifGlobal
m roAssociativeArray refcnt=2 count:0
screen
scene
msg

Main.brs:

sub Main()
m.top.global = {
api_key: “AIzaSyCn9WZzbJdT7XsQOuLYv-kQNmCFbUQ2jQI”,
youTubeApiBaseUrl: “https://www.googleapis.com/youtube/v3/
}

screen = CreateObject(“roSGScreen”)
m.port = CreateObject(“roMessagePort”)
screen.setMessagePort(m.port)

scene = screen.CreateScene(“VideoScene”)
screen.show()

while true
msg = wait(0, m.port)
if type(msg) = “roSGScreenEvent”
if msg.isScreenClosed() then exit while
end if
end while
end sub

The error message is actually complaining about line 4:

Invalid value for left-side of expression. (runtime error &he4) in pkg:/source/main.brs(4)

I don’t think you are allowed to completely reassign m.top.global. so try doing m.top.global.api_key = “AIzaSyCn9WZzbJdT7XsQOuLYv-kQNmCFbUQ2jQI”

m.top.global.youTubeApiBaseUrl = “https://www.googleapis.com/youtube/v3

Also, m.top.global.might not be assigned at that phase.of the app. So it might still fail.

Thanks so much, fixed the error and you were right, it doesn’t seem like it has been assigned so there was a failure. Will work on it some more. Thanks again!

m.global isn’t available in the main thread by default. We usually do something like this in our apps

sub main()
    ...stuff
    screen = createObject("roSGScreen")
    m.global = screen.getGlobalNode()
    ...more stuff
end sub