Your Digital Media Has Never Looked So Good

 
mitchr181
Topic Author
Posts: 5
Joined: Sat Jun 08, 2019 5:31 am

String Concatenation

Sat Jun 08, 2019 5:36 am

I have this code that builds a URL for doing API requests:
Function buildURL(channel As String, token As String, sig As String) as String
  Return "https://usher.twitch.tv/api/channel/hls/" + channel + ".m3u8?player=twitchweb&token=" + token + "&sig=" + sig "&allow_audio_only=true&allow_source=true&type=any&p=" + "7333049"
end Function

But it won't compile. This is the error I'm getting:
*** ERROR compiling /pkg:/source/main.brs:

Syntax Error. (compile error &h02) in pkg:/source/main.brs(37)

I initially thought that there was something going on with string not being mutable so I changed it to this, but I still get the same syntax error:
Function buildURL(channel, token, sig) as String
  Return "https://usher.twitch.tv/api/channel/hls/" + channel.tostr() + ".m3u8?player=twitchweb&token=" + token.tostr() + "&sig=" + sig.tostr() "&allow_audio_only=true&allow_source=true&type=any&p=" + "7333049"
end Function
 
User avatar
squirreltown
Posts: 870
Joined: Sun Apr 21, 2013 2:20 pm

Re: String Concatenation

Sat Jun 08, 2019 6:09 am

both are  missing a + after the sig variable.
Kinetics Screensavers
 
mitchr181
Topic Author
Posts: 5
Joined: Sat Jun 08, 2019 5:31 am

Re: String Concatenation

Sat Jun 08, 2019 7:48 am

Ah I feel like a real idiot, thank you!
 
User avatar
squirreltown
Posts: 870
Joined: Sun Apr 21, 2013 2:20 pm

Re: String Concatenation

Sat Jun 08, 2019 8:03 am

No sweat. I've done it. :D
Kinetics Screensavers

Who is online

Users browsing this forum: No registered users and 3 guests