diff --git a/functions.lua b/functions.lua index 17ebfb6..1a0db1c 100644 --- a/functions.lua +++ b/functions.lua @@ -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);