Skip to content

Commit

Permalink
feat(client/main): getter param overloads to match server (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm authored Dec 4, 2024
1 parent 3f4a8c5 commit c3fa8e1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ QBX.Shared = require 'shared.main'
QBX.IsLoggedIn = false

---@return table<string, Vehicle>
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<number, Vehicle>
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)
Expand All @@ -27,8 +31,10 @@ end
exports('GetVehiclesByCategory', GetVehiclesByCategory)

---@return table<number, Weapon>
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)
Expand Down

0 comments on commit c3fa8e1

Please sign in to comment.