Forum Discussion

EnTerr's avatar
EnTerr
Roku Guru
12 years ago

objFun() = no fun

I was trying to figure out how to use objfun - my understanding is that - given object interface, method name and parameters - it will call said method and return the result. Except i have no luck pleasing it, it seems to insist on at least 3 arguments (object + interface + method_name?) but even then says "member function not found".

So far the only thing i discovered is YAWRR (Yet Another Way to Reboot Roku):
BrightScript Debugger> ? objfun([], "", "")
Connection closed by foreign host.
Should've made career in test engineering, for things seem to fall apart in my hands w/o even trying.

8 Replies

  • What the heck is objFun(), and how in the world do you find these obscure things?
  • "TheEndless" wrote:
    What the heck is objFun(), and how in the world do you find these obscure things?

    Why, by reading some apocryphal bright-scriptures. That's where i learnt about the constant global and ifGlobal too. Not everything has made it into the canon. ObjFun is related to GetInterface and you can see it as a reserved word... if someone had bothered to include the list of reserved words in the wiki!

    By the way, i came with this idea of a game/challenge: "YAWRR Code Golf". It's a code golf, where the goal is to write the shortest code that forces Roku player to reboot. I submit my entry from above - only 16 characters, can someone best that? (Benefit for RokuCo in this code golf is they could patch the issues found, if they see fit)
  • "EnTerr" wrote:
    Why, by reading some apocryphal bright-scriptures.

    Ahh.. the legacy BrightSign documentation.. gotcha.

    "EnTerr" wrote:
    I submit my entry from above - only 16 characters

    I can't get that to crash mine. :?
  • "TheEndless" wrote:
    "EnTerr" wrote:
    I submit my entry from above - only 16 characters

    I can't get that to crash mine. :?

    Doh!
    Do you by any chance live by Lake Wobegon ("where all the women are strong, all the men are good looking, and all the children are above average")?
    For me it worked reliable on Roku 2xxx, 3xxx, 4xxx (fw 3 and 5, tested from console).

    The runner-up for YAWRR CodeGolf i know is 24 chars but discovered by you.
  • di = createObject("roDeviceInfo")
    iface = getInterface(di, "ifDeviceInfo")
    print objFun(di, iface, "getModel")

    Will do the same thing as:
    print di.ifDeviceInfo.getModel()
  • One cannot callFunc() against an object like roDeviceInfo AFAIK