Skip to content

Commit

Permalink
Update main.lua
Browse files Browse the repository at this point in the history
Make the Categories show up alphabetical
  • Loading branch information
Nukulargamer authored Mar 15, 2024
1 parent 557476e commit 821c147
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,24 @@ end
---@param args table<string, any>
local function openVehicleCategoryMenu(args)
local categoryMenu = {}
local sortedCategories = {}
for k, v in pairs(config.shops[insideShop].categories) do
categoryMenu[#categoryMenu + 1] = {
title = v,
arrow = true,
onSelect = function()
openVehCatsMenu(k, args.targetVehicle)
table.insert(sortedCategories, v)
end
table.sort(sortedCategories)
for _, v in ipairs(sortedCategories) do
for k, originalValue in pairs(config.shops[insideShop].categories) do
if v == originalValue then
categoryMenu[#categoryMenu + 1] = {
title = v,
arrow = true,
onSelect = function()
openVehCatsMenu(k, args.targetVehicle)
end
}
break
end
}
end
end

lib.registerContext({
Expand Down

0 comments on commit 821c147

Please sign in to comment.