2016-10-01 100 views
-6
var Structure[undefined] 
function run{ 
    Structure[0] 
} 

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

setStructure(House); 

function House(){ 
    //nothing 
} 

爲什麼返回House()函數不在Structure [0]中? 這是一個Minecraft PE模組。Java腳本功能不起作用

+0

你永遠不會調用'House',你只是通過它(即函數)。 – trincot

回答

1

我想你打算這樣:

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

如果沒有括號,功能run沒有做任何事情。它只是引用該函數,而不用調用它。