Examples
Below are practical examples of how to use Glitch Abstraction's most common functions. These examples demonstrate framework-agnostic code that works across ESX, QBCore, and QBox, as well as with suppo
Getting the Abstraction Library
local GlitchLib = exports['glitch-abstraction']:getAbstraction()Wait for Library to be Ready
CreateThread(function()
while not GlitchLib.IsReady do Wait(100) end
-- Now safe to use GlitchLib functions
end)Sending a Notification (Client)
GlitchLib.Notifications.Success("Hello!", "This is a cross-framework notification.")Showing an Input Dialog (Requires ox_lib)
local result = GlitchLib.UI.Input("Enter Info", {
GlitchLib.UI.Inputs.Text("Name", {required = true}),
GlitchLib.UI.Inputs.Number("Age", {min = 18, max = 100})
})
if result then
print("Name:", result[1], "Age:", result[2])
endUsing a Context Menu (Requires ox_lib)
Adding/Removing Items (Server)
Checking Player Inventory (Client)
Registering a Usable Item (Server)
Target System Example (Client)
Progress Bar (Client, Requires ox_lib)
Door Lock State (Server)
Awarding XP (Server, Requires pickle_xp)
Playing a Cutscene (Client)
Using Scaleform UI (Client)
Framework-Agnostic Callback (Client)
Registering a Server Callback (Server)
Last updated