From c3fa8e1a37edfb5ad9eee078ee84044cb39a8984 Mon Sep 17 00:00:00 2001 From: Matthew <22198949+mafewtm@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:28:29 -0500 Subject: [PATCH] feat(client/main): getter param overloads to match server (#632) --- client/main.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index 745a2fb37..60647773f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -6,15 +6,19 @@ QBX.Shared = require 'shared.main' QBX.IsLoggedIn = false ---@return table -function GetVehiclesByName() - return QBX.Shared.Vehicles +---@overload fun(key: string): Vehicle +function GetVehiclesByName(key) + local vehicles = QBX.Shared.Vehicles + return vehicles[key] or vehicles end exports('GetVehiclesByName', GetVehiclesByName) ---@return table -function GetVehiclesByHash() - return QBX.Shared.VehicleHashes +---@overload fun(key: number): Vehicle +function GetVehiclesByHash(key) + local vehicles = QBX.Shared.VehicleHashes + return vehicles[key] or vehicles end exports('GetVehiclesByHash', GetVehiclesByHash) @@ -27,8 +31,10 @@ end exports('GetVehiclesByCategory', GetVehiclesByCategory) ---@return table -function GetWeapons() - return QBX.Shared.Weapons +---@overload fun(key: number): Weapon +function GetWeapons(key) + local weapons = QBX.Shared.Weapons + return weapons[key] or weapons end exports('GetWeapons', GetWeapons)