I am writing an extension for Micro:Bit that controls an OLED. I have an array that I declare outside of any function. When I try to use it inside of a function I get the error "Program Error: Dereferencing Null/Undefined Value" in an orange pop-up.
As far as I can tell, the program does not recognize the array name inside of any function, and I'm able to create a new array with that name as if it were out of scope. Running the same code directly below the initial declaration (outside of any function) behaves as expected
Below is the simplest version I could make that still produces the error:
//% color="#00CC99"
namespace OLED_Test {
let screenBuffer = [0x00]
//block
export function init() {
let x = screenBuffer[0]
}
}