Skip to content

Commit

Permalink
Added UID to widgets.
Browse files Browse the repository at this point in the history
Added a unique UID to widgets which is unique to the widget struct rather than ID, since an ID can have multiple widget structs over its lifetime.
  • Loading branch information
SirMallard committed Aug 13, 2024
1 parent 513d18d commit 36c7da0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Internal.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local HttpService: HttpService = game:GetService("HttpService")

local Types = require(script.Parent.Types)

return function(Iris: Types.Iris): Types.Internal
Expand Down Expand Up @@ -512,6 +514,7 @@ return function(Iris: Types.Iris): Types.Internal
thisWidget.type = widgetType
thisWidget.parentWidget = parentWidget
thisWidget.trackedEvents = {}
thisWidget.UID = HttpService:GenerateGUID(false):sub(0, 8)

-- widgets have lots of space to ensure they are always visible.
thisWidget.ZIndex = parentWidget.ZOffset
Expand Down
1 change: 1 addition & 0 deletions lib/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export type Widget = {
lastCycleTick: number,
trackedEvents: {},
parentWidget: Widget,
UID: string,

state: States,
arguments: Arguments,
Expand Down

0 comments on commit 36c7da0

Please sign in to comment.