• Parsing modopts.ini

    From Mortifis@VERT/ALLEYCAT to All on Thu Nov 14 11:28:56 2019
    I am trying to read a string from modopts.ini and wanting to split the string filtering out whitespace and then iterating through the string for a match ...

    modopts.ini example:

    [mysection]
    something = bla blah bleh bladdie bluh ble

    my.js

    var mystuff = load({}, 'modopts.ini', 'mysection');

    var stuff = mystuff.something.split((/(\s+)/);


    gives a JS TypeError: mystuff.something is undefined

    What am I doing wrong, please?

    ---
    ■ Synchronet ■ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Thu Nov 14 10:42:36 2019
    Re: Parsing modopts.ini
    By: Mortifis to All on Thu Nov 14 2019 11:28 am

    I am trying to read a string from modopts.ini and wanting to split the string filtering out whitespace and then iterating through the string for a match ...

    modopts.ini example:

    [mysection]
    something = bla blah bleh bladdie bluh ble

    my.js

    var mystuff = load({}, 'modopts.ini', 'mysection');

    var stuff = mystuff.something.split((/(\s+)/);


    gives a JS TypeError: mystuff.something is undefined

    What am I doing wrong, please?

    The second argument to load() should be 'modopts.js' there (not modopts.ini). See other modopts examples in exec/*.js.

    Also, you could get a specific value from your 'mysection' (rather than the entire section as an object), like so:

    var stuff = load({}, 'modopts.js', 'mysection', 'something');

    Docs here:
    http://wiki.synchro.net/custom:javascript:lib:modopts.js

    digital man

    Synchronet "Real Fact" #29:
    Rob Swindell first called BBSes (at 300bps) with an Apple II computer in 1982. Norco, CA WX: 66.3°F, 78.0% humidity, 1 mph NW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to Digital Man on Fri Nov 15 09:40:09 2019
    Re: Parsing modopts.ini
    By: Mortifis to All on Thu Nov 14 2019 11:28 am

    I am trying to read a string from modopts.ini and wanting to split the string filtering out whitespace and then iterating through the string for a match ...

    modopts.ini example:

    [mysection]
    something = bla blah bleh bladdie bluh ble

    my.js

    var mystuff = load({}, 'modopts.ini', 'mysection');

    var stuff = mystuff.something.split((/(\s+)/);


    gives a JS TypeError: mystuff.something is undefined

    What am I doing wrong, please?

    The second argument to load() should be 'modopts.js' there (not modopts.ini).
    ^^^^^^^^^^^^^

    Duh! LOL ... thank you, DM

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