Hi guys :w00t:Author: MaXwEllDeN(I'm)
I have a little and simple function that i made '-'
Code:
function getInAOrder(tabl)
local dat = {}
local tab = {}
local tab2 = {["A"] = 1, ["Ä"] = 1, ["Ã"] = 1, ["Â"] = 1, ["À"] = 1, ["Á"] = 1, ["B"] = 2, ["C"] = 3, ["D"] = 4,
["E"] = 5, ["Ë"] = 5, ["Ê"] = 5, ["À"] = 5, ["F"] = 6, ["G"] = 7, ["H"] = 8, ["I"] = 9, ["Ï"] = 9, ["Ì"] = 9,
["Í"] = 9, ["Î"] = 9,["J"] = 10, ["K"] = 11, ["L"] = 12, ["M"] = 13, ["N"] = 14, ["Ñ"] = 14, ["O"] = 15,
["Ö"] = 15, ["Ó"] = 15, ["Ò"] = 15, ["Ô"] = 15, ["Õ"] = 15,["P"] = 16, ["Q"] = 17, ["R"] = 18, ["S"] = 19,
["T"] = 20, ["U"] = 21, ["V"] = 22, ["W"] = 23, ["X"] = 24, ["Y"] = 25, ["Z"] = 26 }
for a = 1,26 do
table.insert(tab, {})
end
for a, b in pairs(tabl) do
if (tab2[b:sub(1, 1):upper()]) then
table.insert(tab[tab2[b:sub(1, 1):upper()]], b)
else
table.insert(tab[#tab2], b)
end
end
for a, b in ipairs(tab) do
for c, d in ipairs(b) do
table.insert(dat, d)
end
end
return dat
end
What this function make is organize an table in the alphabetical order. If you run this:
Code:
local t = {"Socket", "Lua", "C++", "Linux", "windows", "ubuntu", "C", "Delphi", "Alfa", "Ômega", "PHP", "HTML"}
for a, b in pairs(getInAOrder(t)) do
print(b)
end
Will return this:
Code:
Alfa
C++
C
Delphi
HTML
Lua
Linux
Ômega
PHP
Socket
ubuntu
windows
Sorry my bad english. :/