Roku Developer Program

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

[fixed] eval("return") = RebootSystem()

My latest YAWRR: eval("return") restarts the player. So short, at 14 chars it kills the fun of future code-golfing for the shortest reboot sequence.

How the heck do i find these, you may ask. Well, i was debugging some code and it occurred to me (BASIC childhood memories) that i can exit the nested execution by just typing "return" in the console, and so i tried:
BrightScript Debugger> return          
UNKNOWN ERROR (runtime error &he2) in ...AATjqxRj/pkg:/source/main.brs(24)
BrightScript Debugger> Connection closed by foreign host.
For some reason it popped 2 nested levels and the error shows at the 3rd/top, in main(). What is this E2 error code, i could not find it in bslBrightScriptErrorCodes()?

Looking at the backtrace, i saw something suspicious. I doubt is related - likely a separate buglet - but will mention it just in case. One of the nested functions was shown with the wrong signature:

Function test() As Object
file/line: /tmp/plugin/LDAAAAcGXdAR/pkg:/source/main.brs(27)
The actual function definition is "sub Test(aa=invalid as Object):" - its return is void, so it should have been shown as
Function test(aa As Object) As Void
I think it was the optional param (=invalid) that confuses the dumper.
I am having difficulty finding where optional params are documented in RTFM... but somehow know of them; was it from examples only?!
0 Kudos
1 Reply
Level 8

Re: eval("return") = RebootSystem()

FWIW, seems to have been quietly fixed: eval("return") does not cause reboot anymore on current fw 3 and 5.
0 Kudos