Im making a update log UI, but since i definitely don’t want to do the primitive method of manually editting the UI by hand. I made a script to automaticly do the UI writing for me, and all i have to do is update the log.
While it is working as expected, i would love to have the table reversed so while the most recent update is at the bottom of the script, the actual recent update log appear at the top. Sure, i can just reverse the table writing, but i just dislike writing my newest update at the top of the script.
Is there any way i can reverse this table (or dictionary, whatever this type is called) content?
local ScrollingFrame = script.Parent.Frame.ScrollingFrame
local textLabel = ScrollingFrame.TextLabel
local headerSize = 40
local function Header(text)
return [[<font size="]]..tostring(headerSize)..[[">]]..text..[[</font>]]
end
-- Please add the recent update at the top. Because its look like sorting dictionary normally is impossible
local update = {
{
Header("Version 1"),
"Stuff"
},
{
Header("Version 2"),
"Stuff"
},
{
Header("Version 3"),
"Stuff"
},
{
Header("Version 4"),
"-Stuff"
},
}
for i = 1,#update do
local j = #update - i + 1
update[i], update[j] = update[j], update[i]
end
local actualText = ""
for i,subTxt in pairs(update) do
for i, txt in ipairs(subTxt) do
actualText = actualText..txt.."\n" -- \n is equal enter
end
actualText = actualText.."\n"
end
textLabel.Text = actualText
-- Resize the scrolling frame to fit the text label
ScrollingFrame.CanvasSize = UDim2.fromOffset(0,textLabel.TextBounds.Y)