2013-05-20 67 views
-1

我知道這一個已經問,但我不能找到任何幫助,我的繼承人代碼:LUA:TextRPG.lua:15:試圖調用全球「命令」(一個零值)

print("Welcome to Text RPG \n"); 
function commmand() 
print("What do you want to do? \(\"help\" for help\) \n NOTE: MUST BE IN CAPS") 
input = io.read() 
--condition = input == "HELP" or input == "EAST" or input == "WEST" or input =="NORTH" or      input == "SOUTH" or input == "SHOP" 
    if input == "HELP" or input == "EAST" or input == "WEST" or input =="NORTH" or input==    "SOUTH" or input == "SHOP" then 
     --Future game code 
    end 
    end 
    command() 

我試圖尋找,但我couldent找到答案,我還送一個帳戶只是爲了問這個

回答

1
print("Welcome to Text RPG \n"); 
function command() 
    print("What do you want to do? \(\"help\" for help\) \n NOTE: MUST BE IN CAPS") 
    input = io.read() 
    --condition = input == "HELP" or input == "EAST" or input == "WEST" or input =="NORTH" or input == "SOUTH" or input == "SHOP" 
     if input == "HELP" or input == "EAST" or input == "WEST" or input =="NORTH" or input== "SOUTH" or input == "SHOP" then 
      --Future game code 
     end 
end 
command() 

你需要改變:

function commmand() 

function command() 

注意刪除m

+0

哦,我覺得這麼笨,現在thx的幫助 – user2400186

+0

@ user2400186使用不同的字體:) – HennyH

+0

我不認爲你需要在使用print()時避開括號。 – hjpotter92

相關問題