For example, the code below.
function chooseRandom() local random = table[math.random(1, #table)] return random end
How can I check if the selected random value is "Test", for example? If it is Test, return the value... if not, choose another random value until it meets that condition.
Check the comments for another example.
There's probably a simple way to do this that I'm missing. Does anyone know a solution to accomplish this?
function chooseRandom() local Selected --store our value for selected value repeat Selected = table[math.random(1,#table)] until Selected == "Test" return Selected end