UUID

    Available since v0.4.0

    Generate v4 and v7 UUIDs

    local uuid = require "uuid"
    

    uuid.v4()

    A randomly generated universally unique identifier (UUID) that relies on random or pseudo-random numbers for uniqueness.

    local id = uuid.v4() -- or just calling `uuid()`
    print("v4:", id)
    -- v4:	1c03ac80-06c8-468a-a3d6-42ef52aa6e57
    

    uuid.v7()

    A time-ordered UUID based on Unix timestamps, designed for better performance and database indexing while maintaining high entropy.

    local id = uuid.v7()
    print("v7:", id)
    -- v7:	0195c8f2-a26e-7323-afa0-72eea6ae79cd