lx-lib — Framework Bridge
lx-lib is the shared framework and inventory bridge used by every LX product. It detects your framework at runtime and exposes one LX.* API — which is how a single LX product build runs on Qbox, QB-Core, and ESX.
For copy-ready signatures and return values, see Client Exports and Server Exports.
Supported stacks
Section titled “Supported stacks”| Layer | Supported |
|---|---|
| Framework | qbx_core (Qbox), qb-core (QB), es_extended (ESX) |
| Inventory | ox_inventory (recommended, including on ESX), qb-inventory |
Inventory is optional to lx-lib itself. When no supported inventory is running, lx-lib still starts and installs safe stubs — item APIs return false / 0. Advanced Bus Job currently uses money, identity, notify, and lifecycle through lx-lib; it does not require an inventory for the shipped loop.
ox_lib is optional for lx-lib notifications. lx-lib falls back to native/framework notify when ox_lib is missing. Advanced Bus Job still hard-depends on ox_lib.
Install
Section titled “Install”Follow the standalone lx-lib installation guide for requirements, dependency order, consumer manifest setup, and verification.
Detection runs once when lx-lib starts. Priority is Qbox → QB-Core → ESX for framework, and ox_inventory → qb-inventory for inventory. Only resources already in the started state are considered. If you start or swap an adapter later, restart lx-lib and any consumers.
Configuration
Section titled “Configuration”One option, in the open file shared/config.lua:
Config = { Debug = false, -- true = extra adapter-load traces}Debug = true enables additional adapter-load traces. Framework/inventory summaries and missing-adapter warnings print regardless.
Escrow and adapters
Section titled “Escrow and adapters”init.lua, shared/config.lua, and modules/framework/*.lua / modules/inventory/*.lua stay readable under asset escrow. The server selects the detected adapter at runtime with LoadResourceFile; encrypted module files cannot be loaded that way.
These modules are part of the shipped bridge, not routine buyer configuration. Only edit them when adding a documented framework/inventory adapter or when LX support asks.
API reference
Section titled “API reference”For developers integrating with LX products or writing addons. All functions live on the global LX table after @lx-lib/init.lua is loaded.
Framework info
Section titled “Framework info”LX.GetFramework() -- 'qbx' | 'qb' | 'esx' | nilLX.GetInventory() -- 'ox_inventory' | 'qb-inventory' | nilPlayers (server)
Section titled “Players (server)”LX.GetPlayer(src) -- normalized LX player table, or nilLX.GetIdentifier(src) -- citizenid / identifierLX.GetName(src) -- character nameGetPlayer does not return the raw Qbox/QB/ESX player object. Every adapter returns the same normalized shape:
{ source = number, identifier = string?, name = string, job = { name = string, label = string, grade = number, gradeLabel = string, onDuty = boolean, }, money = { cash = number, bank = number, },}Money (server)
Section titled “Money (server)”LX.GetMoney(src, account) -- account: 'cash' | 'bank' | 'money'LX.AddMoney(src, account, amount, reason?)LX.RemoveMoney(src, account, amount, reason?)LX.HasMoney(src, account, amount)Accounts are cash, bank, and money. money is a portable cash alias: it maps to cash on Qbox/QB and remains money on ESX.
Items (server)
Section titled “Items (server)”LX.HasItem(src, item, count?)LX.GetItemCount(src, item)LX.AddItem(src, item, count, metadata?)LX.RemoveItem(src, item, count, metadata?)RemoveItem accepts optional metadata. ox_inventory forwards it; qb-inventory ignores metadata and removes by item/slot resolution only. Without a supported inventory, item APIs return safe failure values.
Jobs (server)
Section titled “Jobs (server)”LX.GetJob(src) -- { name, label, grade, gradeLabel, onDuty } | nilLX.HasJob(src, name, minGrade?)LX.IsOnDuty(src)On standard ESX there is no universal duty state; absence of an explicit off-duty value is normalized as on-duty.
Notifications & lifecycle
Section titled “Notifications & lifecycle”-- serverLX.Notify(src, message, type?, duration?)
-- clientLX.Notify(message, type?, duration?)LX.OnPlayerLoaded(cb) -- persistent character-ready callbackOnPlayerLoaded registers a persistent client callback. It fires once for each character-ready cycle, resets on character unload (ESX/QB/Qbox), and fires again after the next login. Late registration after the ready event still runs (async next tick). After a resource restart, lx-lib polls for an already-loaded character for up to 15 seconds. Callback errors are isolated with pcall.
Using lx-lib in your own resources
Section titled “Using lx-lib in your own resources”-- fxmanifest.luashared_script '@lx-lib/init.lua'dependency 'lx-lib'init.lua validates that lx-lib is started and errors with a clear message if not.