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: 
Komag
Roku Guru

Re: Variable limit

Wait a second, does that say you have over 2800 functions?!?! :shock: Smiley LOL :shock:

I thought I had a lot with a little over 100!

Thanks for the tests and info. TheEndless, what is the stats command? When I type "help" and see the different commands, nothing looks like stats. I tried "bscs" (which tells me I have almost 14,000 roArray components among other things!), and I tried other things.
0 Kudos
Rek
Visitor

Re: Variable limit

"Komag" wrote:
Wait a second, does that say you have over 2800 functions?!?! :shock: Smiley LOL :shock:

I thought I had a lot with a little over 100!

Thanks for the tests and info. TheEndless, what is the stats command? When I type "help" and see the different commands, nothing looks like stats. I tried "bscs" (which tells me I have almost 14,000 roArray components among other things!), and I tried other things.


Actually it's closer to 3500 Smiley LOL That command only counts top-level functions; it won't include functions defined in-line like this:


function main() as Void
data = loadDataList()

applyTransformation(data, function(a) as Void
if type(a.date) <> invalid
a.date = dateCreateWithString(a.date)
end if
end function)
end function
0 Kudos
Komag
Roku Guru

Re: Variable limit

What's your program, what do you do? :?:
0 Kudos
EnTerr
Roku Guru

Re: Variable limit

"Komag" wrote:
Is this confirmed in anyone's experience, that it's per function, and that it's 255?

All variables in BrightScript are local, i.e. "per function". The reason why locals are fast and why 8-bit number limit would have been easier to explain if "they" haven't disabled the disassembler command. <grumble>

"Rek" wrote:
The limit appears to be 253 on my Roku 2. The following snippet works fine, until adding one more variable ("x253 = 253") ...

+1 for the "m" local var (which you are granted regardless) = 254
0 Kudos
TheEndless
Channel Surfer

Re: Variable limit

"Komag" wrote:
TheEndless, what is the stats command? When I type "help" and see the different commands, nothing looks like stats.

Wow.. it looks like they got rid of the stats command in a recent firmware update. It used to list a count of all variable types and their limits, including functions. Wonder why they ditched it... :?:
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Roku Guru

Re: Variable limit

"Rek" wrote:


FUNCTION getSounds() ' trig by Main(1) near top
hitMon = CreateObject("roAudioResource", "pkg:/sounds/hitMon.wav")
missMon = CreateObject("roAudioResource", "pkg:/sounds/missMon.wav")
hitPlayer = CreateObject("roAudioResource", "pkg:/sounds/hitPlayer.wav")
missPlayer = CreateObject("roAudioResource", "pkg:/sounds/missPlayer.wav")
deathMon = CreateObject("roAudioResource", "pkg:/sounds/deathMon.wav")
sounds = {hitMon: hitMon, missMon: missMon, hitPlayer: hitPlayer, missPlayer: missPlayer, deathMon: deathMon} ' I don't think this is best way to do it
RETURN sounds
END FUNCTION

That way Main() is only adding one more variable, an AA with all the sounds.
(Would this be the right approach?)

It's acceptable. And with small modification, shortage of variables averted:

function loadSounds():
sounds = { }
for each name in ["hitMon", "missMon", "hitPlayer", "missPlayer", "deathMon"]:
sounds[name] = CreateObject("roAudioResource", "pkg:/sounds/" + name + ".wav")
end for
return sounds
end function
0 Kudos
EnTerr
Roku Guru

Re: Variable limit

"TheEndless" wrote:
Wow.. it looks like they got rid of the stats command in a recent firmware update. It used to list a count of all variable types and their limits, including functions. Wonder why they ditched it... :?:

"Catch-22" wrote:
"Why not?" was Chief White Halfoat's answer.
Smiley LOL
0 Kudos
EnTerr
Roku Guru

Re: Variable limit

"squirreltown" wrote:
you don't even have to wrap it in Sub Main()/End sub

Wait... WAT?!
How is that going to work, B/S does not allow executable code outside of a function. Did i miss some change in the language?
0 Kudos
Komag
Roku Guru

Re: Variable limit

"EnTerr" wrote:
And with small modification, shortage of variables averted:

function loadSounds():
sounds = { }
for each name in ["hitMon", "missMon", "hitPlayer", "missPlayer", "deathMon"]:
sounds[name] = CreateObject("roAudioResource", "pkg:/sounds/" + name + ".wav")
end for
return sounds
end function

(slaps forehead) Of course! I've tried to train myself to search and destroy repeating code, but I missed it this time! I'll use that, thanks.
0 Kudos
squirreltown
Roku Guru

Re: Variable limit

"EnTerr" wrote:
"TheEndless" wrote:
Wow.. it looks like they got rid of the stats command in a recent firmware update. It used to list a count of all variable types and their limits, including functions. Wonder why they ditched it... :?:

"Catch-22" wrote:
"Why not?" was Chief White Halfoat's answer.
Smiley LOL

My understanding is that the "stats" command along with the legacy firmware updaters was traded for a load of egyptian cotton. Cheer up Endless! you've got shares in the syndicate!
Kinetics Screensavers
0 Kudos