DirkScripts Logo

Login With FiveM

Login

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

file

File

ℹ️ Server Module - This can only be used on the server

lib.file.load

Load a JSON file and parse it into a table.

lua
local data = lib.file.load('data/config.json')
local data = lib.file.load('data/config.json', true) -- from calling resource
ParameterTypeRequiredDescription
pathstringyesFile path relative to the resource
from_centralbooleannoIf true, loads from the calling resource instead of dirk_lib

Returns the parsed table, or false if the file doesn't exist.

lib.file.save

Save a table as a JSON file.

lua
lib.file.save('data/config.json', myData)
lib.file.save('data/config.json', myData, true) -- to calling resource
ParameterTypeRequiredDescription
pathstringyesFile path
datatableyesData to serialise
from_centralbooleannoIf true, saves to the calling resource

Returns true on success.

lib.file.inDirectory

List files matching a pattern in a directory.

lua
local files, count = lib.file.inDirectory('data/', '*.json')
ParameterTypeRequiredDescription
pathstringyesDirectory path
patternstringyesFile pattern to match

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.