Skip to main content
added 180 characters in body
Source Link
table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'} --my table have 5 item.

rand= math.random(1~5) --create a random number numbers 1 to 5 if more than 5 then the value is nil.

print(rand)
print(table[rand]) --unite the random number and item it will display 5 random items in the table.
table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5)
print(rand)
print(table[rand])
table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'} --my table have 5 item.

rand= math.random(1~5) --create a random number numbers 1 to 5 if more than 5 then the value is nil.

print(rand)
print(table[rand]) --unite the random number and item it will display 5 random items in the table.
added 20 characters in body
Source Link

table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5) print(rand) print(table[rand])

table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5)
print(rand)
print(table[rand])

table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5) print(rand) print(table[rand])

table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5)
print(rand)
print(table[rand])
Source Link

table = {'Apple', 'Banana', 'Orange', 'Watermelon' , 'lychee'}

rand= math.random(1~5) print(rand) print(table[rand])