DirkScripts Logo

Login With FiveM

Login

πŸ“š Library
β€Ί
Modules
β€Ί

require

Require

ℹ️ Shared Module

lib.require

Loads, caches, and returns a module. Detects circular dependencies. Searches native require, then package.preload, then file-based loading.

lua
local utils = lib.require('utils')
local remote = lib.require('@otherResource.shared.helpers')
ParameterTypeRequiredDescription
modNamestringyesModule name. Prefix with @resourceName. to load from another resource

Returns: module return value (cached after first load)

lib.load

Loads and runs a Lua file. Unlike require, the result is not cached β€” the file is executed every time.

lua
local result = lib.load('shared/config')
local bridgeResult = lib.load('bridge/keys/qbx', nil, true)
ParameterTypeRequiredDescription
filePathstringyesPath to the Lua file
envtablenoCustom environment for the loaded chunk
bridgebooleannoIf true, returns false instead of erroring when the file is not found

lib.loadJson

Loads and decodes a JSON file.

lua
local config = lib.loadJson('config/settings')
ParameterTypeRequiredDescription
filePathstringyesPath to the JSON file

lib.loadBridge

Loads a bridge module for a specific resource and context.

lua
local keysBridge = lib.loadBridge('keys', 'qb-vehiclekeys', 'client')
ParameterTypeRequiredDescription
_typestringyesBridge category (e.g. 'keys', 'fuel', 'inventory')
resourcestringyesTarget resource name
_contextstringyes'client' or 'server'

Loads from @dirk_lib.bridge.{_type}.{resource}.{_context}. Returns {} if the bridge file is not found.

Package System

The module system provides a package table compatible with Lua conventions:

FieldDescription
package.path'./?.lua;./?/init.lua'
package.preloadTable for pre-registered modules
package.loadedRead-only view of the module cache
package.searchpath(name, path)Searches for a file matching the template pattern

Copyright Β© 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.