Hi all
please i really need help with checking boundaries for input into a game im building.
Basically i have got an array which includes all the valus that is acceptable so i want to check the user input with this table.
if its in the table then its accepted, but if its not then the user is asked to enter their value again, i have dis code at the moment which does not seems to be doing anything.
arrStake = { 1,2,3,4,5,6,7,8,9,10,11,12,13 }
–>While loop to play the 13 rounds
i = 1
while i <= 5 do
print’Enter the Stake?’
stake = io.stdin:read’*l’
int1 = tonumber(stake)
if int1 == arrStake
then
print(‘stake You gave is =’,stake)
table.remove(arrStake, stake)
else if int1 ~= arrStake
then
repeat
print(“The stake given has been played before”)
print’Enter the Stake?’
stake = io.stdin:read’*l’
int1 = tonumber(stake)
until int1 == arrStake
print(“stake ok now”)
print(‘stake You gave is =’,stake)
table.remove(arrStake, stake)
end
end
i = i + 1
end
Thanks for helping in advance [import]uid: 104213 topic_id: 17708 reply_id: 317708[/import]