guid

Methods

Methods

new()

Generates a GUID and associates it with the given value.

Parameters

.guid.new(
    value: any,
    wrapped: boolean?
): string

Code Sample

local guid = require(MainPackages.guid)

local myGuid = guid.new('Hello World')
print(myGuid) -- b454790-7563-44ed-ab4b-397ff5df737b

get()

Returns an array of generated GUIDs, or the value of GUID if the index is specified.

Parameters

.guid.get(
    i: string?
): {}

Code Sample

local guid = require(MainPackages.guid)
local myGuid = 'b454790-7563-44ed-ab4b-397ff5df737b'

local myGuid = guid.get(myGuid)
print(myGuid) -- Hello World

match()

Checks if the given GUID exists.

Parameters

.guid.match(
    guid: string
): boolean

Code Sample

local guid = require(MainPackages.guid)
local myGuid = 'b454790-7563-44ed-ab4b-397ff5df737b'

local isValid = guid.match(myGuid)
if isValid then
    print('GUID is valid')
end

remove()

Removes the given GUID if it exists.

Parameters

.guid.remove(
    guid: string
): boolean

Code Sample

local guid = require(MainPackages.guid)
local myGuid = 'b454790-7563-44ed-ab4b-397ff5df737b'

guid.remove(myGuid)

update()

Updates the value associated of the given GUID if it exists.

Parameters

.guid.update(
    guid: string,
    value: any
): {}

Code Sample

local guid = require(MainPackages.guid)
local myGuid = 'b454790-7563-44ed-ab4b-397ff5df737b'

guid.update(myGuid, 'I am the new value!')
print(myGuid) -- I am the new value!