legacy-lib
Overview
What legacy-lib is and how it fits into the Legacy Scripts ecosystem.
legacy-lib
legacy-lib is the shared library that every other Legacy Scripts resource depends on. It is not a standalone gameplay feature — it exists purely to give dependent resources a single, consistent API surface regardless of what framework, banking, inventory, or target system the server is actually running.
What it provides
- Framework abstraction (
Framework.*) — a unified API over ESX, QBCore, QBox, or no framework at all (player identity, jobs, money, metadata). - Banking abstraction (
Banking.*) — a unified API overlegacy-banking,qb-banking,Renewed-Banking, or a no-op default. - Inventory abstraction (
Inventory.*server-side,InventoryClient/Inventory()client-side) — a unified API overox_inventory,qb-inventory,qs-inventory, or a no-op default. - Target abstraction (
Target()client-side) — a unified API overox_target,qb-target, or a no-op default. - Branding/theming —
GetAccentColor,GetAccentGradient,GetLogo,moduleName,server— so every Legacy Scripts UI shares the same look. - Locale loading —
GetLocale, which loads a calling resource's ownlocales/<lang>.json. - Discord webhooks —
SendWebhook, for embed notifications. - File-backed JSON config store —
Store()(Store.Read/Store.Write/Store.ReadOrMigrate), for admin-authored data such as zone placements, shop definitions, recipes, and job listings. - Version checking —
CheckVersion, which compares a resource's version against a hosted manifest and prints an update notice.
Each abstraction layer works the same way internally: a _default.lua file loads first and installs safe no-op fallbacks, then bridge files for specific third-party resources (e.g. es_extended.lua, qb-core.lua, qbx_core.lua, ox_target.lua, qb-banking.lua, ...) detect whether their target resource is running via GetResourceState and overwrite the relevant functions on the shared global table (Framework, Banking, Inventory, Target).
Support
Full external documentation: https://legacy-docs.vercel.app/ Support is Discord-only: https://discord.gg/P2Jujr3Khh (no issue tracker).