if I have a table with for instance
local g = {'hello','idk','more stuff'}
--please correct me if im using the wrong brackets--
how would i get something random from it?
if I have a table with for instance
local g = {'hello','idk','more stuff'}
--please correct me if im using the wrong brackets--
how would i get something random from it?
you would do something like this:
local g = {'hello','idk','more stuff'}
local variable = math.random(1,#g)
-- get random number from 1 to the table's length, which is 3 because there is 3 things inside
local randommember = g[variable]
-- get random member from table as you have a random number from 1 to the max stuff in the table, then use that number to pull a string(text), randomly.
print(randommember)
-- you get a random member from the table!
This discussion is preserved as it was. New answers, comments, and votes are closed.