Skip to content

ox_lib — Reference ​

Available after @ox_lib/init.lua is loaded. Used in overextended resources and some lg_* scripts.

lua
-- Zones
local zone = lib.zones.box({ coords = ..., size = ..., rotation = ..., debug = false })
zone:remove()

-- UI
lib.showContext(id)
lib.registerContext({ id = 'myMenu', title = 'Menu', options = { ... } })
lib.progressBar({ duration = 3000, label = '...', useWhileDead = false, canCancel = true })
lib.progressCircle({ ... })
lib.notify({ title = '...', description = '...', type = 'success' })

-- Callbacks
lib.callback.register('myResource:cb', function(source, ...)
    return result
end)
local result = lib.callback.await('myResource:cb', false, ...)

-- Input dialog
local result = lib.inputDialog('Title', { { type = 'input', label = 'Name' } })

-- Alert dialog
local confirm = lib.alertDialog({ header = '...', content = '...', centered = true, cancel = true })