local a= >3500
local b=
local c= <3700
我不知道如何将两者之间的200个数字变成变量b
lives=1
while lives > 0 do
math.randomseed(os.time())
local randomNumber1 = math.random(7200)
local randomNumber = math.random(randomNumber1, 7200)
print("Welcome to roulette!")
local a= >3500
local b=
local c= <3700
local number1 = io.read()
local number1 = tonumber(number1)
if
number1== a
and randomNumber == a then
print("You won!")
print("Number was "..randomNumber..)
else if
number1 == b
and randomNumber == b then
print("You won!")
print("Number was "..randomNumber..)
else if
number1 == c
and randomNumber == c then
print("You won!")
print("Number was "..randomNumber..)
else
print("Du tabte")
print("Number was "..randomNumber..)
io.read()
lives=lives-1
end
答案 0 :(得分:1)
您可以使用数字for循环。为了在一个变量中存储多个值,请使用表格。
local numbers = {}
local from = 3500
local to = 3699
for number = from, to do
table.insert(numbers, number)
end
答案 1 :(得分:0)
您不能在一个变量中存储多个值。
您可以在表中存储多个值,并将该单个表放在变量中,如果您希望将多个表存储在一个位置,则可以放入另一个表中。