window.getvar = function(vname){
    let root = vname.split("[")[0];
    if(State.getVar(root) == undefined)
        return 0;
    let value = State.getVar(vname);
    if(value == undefined)
        return 0;
    return value;
}
