Announcement

Collapse
No announcement yet.

Scoping problem?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scoping problem?

    I split a working EFS into two EFSs that communicate via global variables, which seems to be working basically OK.

    However, I'm getting a runtime error that I don't understand. The following code:

    ...
    qsEnterTradeMsg = qEnterTrade();
    if (qsEnterTradeMsg != null) {
    debugPrintln(qsEnterTradeMsg);
    } else {
    debugPrintln(TRENDS.DIR[TRENDS.IX] + " trade authorized @ " + MARKET.CUR.TRADE);
    addETrade();
    }
    return;

    function qEnterTrade() {
    ...
    }

    produces this error "ReferenceError: qEnterTrade is not defined"

    If I move the qEnterTrade function to the end of the EFS (putting it at same scope level as premain() and main(), then it works OK. This makes me think that there's a scoping problem, but I can't figure out what it is.

    Any ideas? Thanks.

  • #2
    Wait, I see the problem. Sorry!

    Comment

    Working...
    X