DirkScripts Logo

Login With FiveM

Login

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

string

String

ℹ️ Shared Module β€” extends the global string table

string.random

Generates a random string based on a pattern.

lua
local serial = string.random('1111-AAAA-aaaa') -- e.g. "4827-KFMZ-pqxl"
local code = string.random('AAA-111')           -- e.g. "XKR-482"
ParameterTypeRequiredDescription
patternstringyesPattern string (see characters below)
lengthintegernoPad or truncate result to this length

Pattern Characters

CharGenerates
1Random digit (0–9)
ARandom uppercase letter (A–Z)
aRandom lowercase letter (a–z)
.Random alphanumeric character
^Next character is treated as a literal
anything elsePassed through as-is

Examples

lua
string.random('11-AAA')       -- "47-QKM"
string.random('^1111')        -- "1423" (first '1' literal via ^, rest random)
string.random('....-....')    -- "k4Rz-9xBm"

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.