lua:TextRPG.lua:15:尝试调用全局'命令'(零值)

时间:2013-05-20 01:57:02

标签: lua

我知道这个问题已被问到,但我找不到任何有用的东西,继承我的代码:

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()

我尝试过搜索,但我找到了答案,我甚至只是想问这个问题

1 个答案:

答案 0 :(得分: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