WoWInterface - View Single Post - Picking a random entry out of a table/list?
View Single Post
12-17-20, 11:32 AM   #6
I did that?
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,348
If the table has a number entries and the first 5 are for one situation and the next 5 (or whatever) are for another situation then you could:

Lua Code:
  1. if a then
  2.    PlaySoundFile(TableofOggs[random(1, 5)])
  3. elseif b then
  4.    PlaySoundFile(TableofOggs[random(6, 12)])
  5. elseif ...
  7. end
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote