Freiver Freiver - 2 months ago 7
Javascript Question

Java Script function does not work

var Structure[undefined]
function run{
Structure[0]
}

function setStructure(structure){
Structure[0]=structure
}

setStructure(House);

function House(){
//nothing
}


Why is the return of House() function not in Structure[0]?
It is for a Minecraft PE mod.

Answer

I suppose you intended this:

function run{
    Structure[0]() // <--- notice the parentheses.
}

Without the parentheses, the function run does not do anything. It just references the function, without invoking it.

Comments