Jump to content
  • 0

How to make your gg.choice ALPHABETICALLY in order?


Gaming_47

Question

Hello, I just want to ask if this is possible in gg.choice. If so, how? Thanks to whoever replies to this. This will be helpful for everyone. :))

ex.
  function example()
    list = gg.choice({
      "Z",
      "F",
      "C",
      "A",
      "B"
    })

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

you can use table.sort your list, but for this you will need to create a separated list
 

local list = { "z", "t", "a" }
table.sort(list)
gg.choice(list)

but be aware that this modify the original table order

Link to comment
Share on other sites

@MonkeySAN  Let's say if I have 500 items in gg.choice how can we make those items alphabetically in order without doing it manually?

function example()
    list = gg.choice({"Zebra", "Fish", "Cat", "Alligator", "Bat"})

because this will output:
      Zebra
      Fish
      Cat
      Alligator
      Bat
when you call it right?

Now, I want it to output in Alphabetical order:
     Alligator
     Bat
     Cat
     Fish 
     Zebra

But, let's say if I have 500 lists of items... How can we do this?

Is it possible to do table.sort to do it? Thank you :))

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.