Using Obsi Lib

Importing the library into your own resource and what to know before you start.

This page shows how to use Obsi Lib from your own resource.

Import it

Add the import to your fxmanifest.lua:

fxmanifest.lua
shared_script '@obsi-lib/init.lua'

Then use the global ObsiLib anywhere, on the server and the client.

Without the import, get the object from the export:

local ObsiLib = exports['obsi-lib']:get()

Server and client

Server and client get different modules under the same names where it makes sense. ObsiLib.items reads your own items on the client and edits anyone's items on the server.

Good to know

  • Everything you register (callbacks, usable items, points, target zones, keybinds, DUIs, state listeners) is removed automatically when your resource stops.
  • ObsiLib.framework and ObsiLib.inventory tell you what was detected.
print(ObsiLib.framework)   -- 'esx' | 'qb' | 'qbx' | 'custom'
print(ObsiLib.inventory)   -- 'ox_inventory' | 'qb-inventory' | ... | 'custom' | 'framework'