Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I turn the contents of a list into buttons sorted in alphabetical order?

Asked by 5 years ago
Edited 5 years ago

Hello, Today, I was working on a script that would help me save ID's, assets, and whatever else that I might want to save.

I'm looking for a way to turn variable into a button. i.e I'm trying to make this

local table =
{
    ["ItemB"] = {
        Text = 'Test Something'
        }
    ["ItemA"] = {
        Text = 'Something else'
        }
    ["ItemS"] = {
        Text = 'IDK'
        }

}

Into three buttons in alphabetical order, that when you click, prints the string in their respective "Text"

If you know how I may achieve this, it would be nice if you could leave a answer. I am still new to scripting so I apologize if these questions and terminology are cringeworthy.

Thanks!

0
Well you can only sort arrays and you have a dictionary, so you need some representation of your data in array form, be it just the keys to index the table you have or the items themselves. Then you can use the table.sort function, together with you your own sorting criteria. gullet 471 — 5y
0
^ So... something like local table = {} table.info {{"Name", Text}}? xForVowels 6 — 5y

Answer this question