added function yl_speak_up.sort_keys

This commit is contained in:
Sokomine 2021-06-03 18:07:03 +02:00
parent bd89ba9d56
commit cfe6f83ad4

View File

@ -1986,6 +1986,17 @@ yl_speak_up.get_sorted_options = function(options, sort_by)
end
-- simple sort of keys of a table
yl_speak_up.sort_keys = function(t)
local keys = {}
for k, v in pairs(t) do
table.insert(keys, k)
end
table.sort(keys)
return keys
end
-- helper function for formspec "yl_speak_up:talk" *and* formspec "yl_speak_up:edit_option_dialog"
-- when a parameter was changed in edit mode;
-- this is called when the player is in edit_mode (editing the NPC);