Skip to main content

GlobalUpdates

This item only works when running on the server. Server

Used to add, lock and change global updates

Revealed through :PostGlobalUpdate()

Types

GlobalUpdateData

type GlobalUpdateData = {[any]any}

GlobalUpdates

type GlobalUpdates = {
Idnumber,
Updates{GlobalUpdate}
}

Id is the most recent update index

Functions

AddGlobalUpdate

GlobalUpdates:AddGlobalUpdate(globalData{}) → Promise<number>

Adds a global update to the Keep

globalUpdates:AddGlobalUpdate({
	Hello = "World!",
}):andThen(function(updateId)
	print("Added Global Update!")
end)

ChangeActiveUpdate

GlobalUpdates:ChangeActiveUpdate(
updateIdnumber,
globalData{}
) → Promise

Change an active global update's data to the new data.

Useful for stacking updates to save space for Keeps that maybe receiving lots of globals. Ex. a content creator receiving gifts

RemoveActiveUpdate

GlobalUpdates:RemoveActiveUpdate(updateIdnumber) → Promise

Removes an active global update

local updates = globalUpdates:GetActiveUpdates()

for _, update in updates do
	globalUpdates:RemoveActiveUpdate(update.Id):andThen(function()
		print("Removed Global Update!")
	end)
end

GetActiveUpdates

GlobalUpdates:GetActiveUpdates() → {GlobalUpdate}

Types

type GlobalUpdate = {
Idnumber,
Lockedboolean,
}

Returns all active global updates

local updates = globalUpdates:GetActiveUpdates()

for _, update in updates do
	print("ActiveUpdate data:", update.Data)
end
Show raw api
{
    "functions": [
        {
            "name": "AddGlobalUpdate",
            "desc": "Adds a global update to the Keep\n\n```lua\nglobalUpdates:AddGlobalUpdate({\n\tHello = \"World!\",\n}):andThen(function(updateId)\n\tprint(\"Added Global Update!\")\nend)\n```",
            "params": [
                {
                    "name": "globalData",
                    "desc": "",
                    "lua_type": "{}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<number>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 43,
                "path": "src/GlobalUpdates.luau"
            }
        },
        {
            "name": "ChangeActiveUpdate",
            "desc": "Change an **active** global update's data to the new data.\n\nUseful for stacking updates to save space for Keeps that maybe receiving lots of globals. Ex. a content creator receiving gifts",
            "params": [
                {
                    "name": "updateId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "globalData",
                    "desc": "",
                    "lua_type": "{}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 80,
                "path": "src/GlobalUpdates.luau"
            }
        },
        {
            "name": "RemoveActiveUpdate",
            "desc": "Removes an active global update\n\n```lua\nlocal updates = globalUpdates:GetActiveUpdates()\n\nfor _, update in updates do\n\tglobalUpdates:RemoveActiveUpdate(update.Id):andThen(function()\n\t\tprint(\"Removed Global Update!\")\n\tend)\nend\n```",
            "params": [
                {
                    "name": "updateId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 129,
                "path": "src/GlobalUpdates.luau"
            }
        },
        {
            "name": "GetActiveUpdates",
            "desc": "Returns all **active** global updates\n\n```lua\nlocal updates = globalUpdates:GetActiveUpdates()\n\nfor _, update in updates do\n\tprint(\"ActiveUpdate data:\", update.Data)\nend\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ GlobalUpdate }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 185,
                "path": "src/GlobalUpdates.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "GlobalUpdateData",
            "desc": "",
            "lua_type": "{ [any]: any }",
            "source": {
                "line": 192,
                "path": "src/Types.luau"
            }
        },
        {
            "name": "GlobalUpdate",
            "desc": "",
            "lua_type": "{ Id: number, Locked: boolean, Data: GlobalUpdateData }",
            "source": {
                "line": 199,
                "path": "src/Types.luau"
            }
        },
        {
            "name": "GlobalUpdates",
            "desc": "```Id``` is the most recent update index",
            "lua_type": "{ Id: number, Updates: { GlobalUpdate } }",
            "source": {
                "line": 212,
                "path": "src/Types.luau"
            }
        }
    ],
    "name": "GlobalUpdates",
    "desc": "Used to add, lock and change global updates\n\nRevealed through [:PostGlobalUpdate()](Store#PostGlobalUpdate)",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 24,
        "path": "src/GlobalUpdates.luau"
    }
}