【发布时间】:2020-08-28 01:43:49
【问题描述】:
我正在学习用 Lua 编程,我正在尝试练习使用函数和数组。
这个想法是程序接受用户输入并验证所述数据是否存在于数组中,否则它应该返回它不存在。
number = {"1", "2", "3"}
function prompt(input)
if input == number then
return print("Yes your number is here")
else
return print("Nope, your number not here")
end
end
prompt = tostring(io.read())
但是,在这种情况下,我似乎没有完全理解如何调用我的函数来使用它,我应该如何构造它?
【问题讨论】: