Blockly Global Variables

Posted on
  • Hi, I'm creating my own Blocks in Blockly by editing blockly_espruino.js. I can create global variables at the top of the file like

    var ESPRUINO_COL = 190;
    

    that are accessible in functions like

    Blockly.Language.espruinoXXX = {...};
    

    but these variables cannot be accessed in functions like

    Blockly.JavaScript.espruinoXXX = function() {...};
    

    How do I create global variables that I can then edit inside the JavaScript that defines what the block does?

    Thanks,
    Rehman

  • I'm afraid I'm not sure about this - you'd hope that functions would have access to the scope in which they were defined. Perhaps you could ask on Blockly's forum? https://groups.google.com/forum/#!forum/blockly

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Blockly Global Variables

Posted by Avatar for rsm @rsm

Actions