Module:Sandbox: Difference between revisions

From The Deadlock Wiki
Jump to navigation Jump to search
test
No edit summary
Line 1: Line 1:
local function get_all_item_names()
function p.get_all_item_names()
     local items = {}
     local items = {}
      
      
Line 19: Line 19:
     return table.concat(items, ", ")
     return table.concat(items, ", ")
end
end
return p

Revision as of 19:58, 21 April 2025

Documentation for this module may be created at Module:Sandbox/doc

function p.get_all_item_names()
    local items = {}
    
    for item_key, item_data in pairs(items_data) do
        if item_data["Name"] ~= nil and item_data["IsDisabled"] == false then
            local lang_code = lang_module.get_lang_code()
            local item_name_local = lang_module.get_string(item_key, lang_code)
            
            if item_name_local and item_name_local ~= "" then
                table.insert(items, item_name_local)
            end
        end
    end
    
    -- Сортируем имена предметов по алфавиту
    table.sort(items)
    
    -- Объединяем через запятую
    return table.concat(items, ", ")
end

return p