• console.getkeys

    From Mortifis@VERT/ALLEYCAT to All on Wed Jul 24 16:39:55 2019
    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser);
    where lastuser=system.lastuser... if entering a number it throws a
    !Javascript TypeError:

    What is the correct usage of console.getkeys? I inferred:


    console methods
    getkeys:
    number console.getkeys(string keys [,maxnum]) 3.10 get one key from of a list of valid command keys, or a number between 1 and maxnum


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Wed Jul 24 17:00:44 2019
    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:

    That looks like it should work. What's the full text of the error?

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Digital Man@VERT to Mortifis on Wed Jul 24 14:30:23 2019
    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 04:39 pm

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser);
    where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:

    What is the correct usage of console.getkeys? I inferred:


    console methods
    getkeys:
    number console.getkeys(string keys [,maxnum]) 3.10 get one key from m of
    a list of valid command keys, or a number between 1 and maxnum

    It seems to work for me. Perhaps it's what you're *doing* with the lookup value. Are you getting a line number with the error? What line of JavaScript corresponds with that line number?

    digital man

    Synchronet/BBS Terminology Definition #12:
    CBM = Commodore Business Machines
    Norco, CA WX: 98.3øF, 30.0% humidity, 13 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to echicken on Wed Jul 24 18:32:12 2019
    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:

    That looks like it should work. What's the full text of the error?

    !JavaScript C:\sbbs\exec\dup_user_check.js line 277: TypeError: lookup.toUpperC
    ase is not a function

    I suspect that the toUpperCase() is not be supported by the console.getkeys() function :-/

    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Wed Jul 24 14:37:12 2019
    Re: Re: console.getkeys
    By: Mortifis to echicken on Wed Jul 24 2019 06:32 pm

    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:

    That looks like it should work. What's the full text of the error?

    !JavaScript C:\sbbs\exec\dup_user_check.js line 277: TypeError: lookup.toUpperC
    ase is not a function

    I suspect that the toUpperCase() is not be supported by the console.getkeys() function :-/

    toUpperCase() is not supported by JavaScript Numbers. console.getkeys() can return a number or a string, depending on the user input.

    digital man

    Synchronet "Real Fact" #56:
    Synchronet Terminal Server introduced SecureShell (SSH) support w/v3.14a (2006).
    Norco, CA WX: 98.3øF, 30.0% humidity, 13 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to echicken on Wed Jul 24 18:52:01 2019
    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:


    perhaps I should run a condition check similar to if(lookup == [whatever || ... keys are in getkeys)) before I lookup.toUpperCase ... though before it was lookup = readln() and there was no error


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Wed Jul 24 15:36:02 2019
    Re: Re: console.getkeys
    By: Mortifis to echicken on Wed Jul 24 2019 06:52 pm

    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:


    perhaps I should run a condition check similar to if(lookup == [whatever || ... keys are in getkeys)) before I lookup.toUpperCase ... though before it was lookup = readln() and there was no error

    readln() returns either a string or undefined. undefined.toUpperCase() would also throw a JS exception.

    You might want to use typeof in this case to be sure your variable is a string before you start treating it like a string.

    digital man

    This Is Spinal Tap quote #29:
    I find lost luggage. I locate mandolin strings in the middle of Austin!
    Norco, CA WX: 97.2øF, 29.0% humidity, 14 mph NE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to Digital Man on Thu Aug 8 09:43:38 2019
    Re: Re: console.getkeys
    By: Mortifis to echicken on Wed Jul 24 2019 06:52 pm

    Re: console.getkeys
    By: Mortifis to All on Wed Jul 24 2019 16:39:55

    I have if(js.global.console) lookup = console.getkeys("HSOQ", lastuser); where lastuser=system.lastuser... if entering a number it throws a !Javascript TypeError:


    perhaps I should run a condition check similar to if(lookup == [whatever || ... keys are in getkeys)) before I lookup.toUpperCase ... though before it was lookup = readln() and there was no error

    readln() returns either a string or undefined. undefined.toUpperCase() would also throw a JS exception.

    You might want to use typeof in this case to be sure your variable is a string before you start treating it like a string.

    digital man

    Thank you, I am still learning JS/C :\ I ended up using if(isNaN(lookup)) { ... } block. I am sure typeof is more flexible :-)


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81