sort generators in ui
This commit is contained in:
parent
07169761cd
commit
c0c0104b5e
@ -2,13 +2,18 @@ settings = session.get_entry('new_world')
|
|||||||
|
|
||||||
function on_open()
|
function on_open()
|
||||||
local names = generation.get_generators()
|
local names = generation.get_generators()
|
||||||
table.sort(names)
|
local keys = {}
|
||||||
|
for key in pairs(names) do
|
||||||
|
table.insert(keys, key)
|
||||||
|
end
|
||||||
|
table.sort(keys)
|
||||||
|
|
||||||
local panel = document.root
|
local panel = document.root
|
||||||
for k, caption in pairs(names) do
|
for _, key in ipairs(keys) do
|
||||||
|
local caption = names[key]
|
||||||
panel:add(gui.template("generator", {
|
panel:add(gui.template("generator", {
|
||||||
callback=string.format("settings.generator=%q menu:back()", k),
|
callback=string.format("settings.generator=%q menu:back()", key),
|
||||||
id=k,
|
id=key,
|
||||||
name=settings.generator_name(caption)
|
name=settings.generator_name(caption)
|
||||||
}))
|
}))
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user