Compare commits

...

2 Commits

Author SHA1 Message Date
Jill dcdf9cbd49 getChildren util func 2022-12-13 21:33:45 +03:00
Jill b08cca38b7 more helpful errors 2022-12-13 20:33:08 +03:00
2 changed files with 21 additions and 0 deletions

View File

@ -307,6 +307,17 @@
resetOnFrameStartActors[actor.__raw or actor] = bool
end
local actorAssociationTable = {}
function getChildren(frame)
local c = actorAssociationTable[frame]
if c then
return c
else
error('uranium: actorframe doesn\'t exist (or isn\'t an actorframe)', 2)
end
end
-- actors
local actorQueue = {}
@ -580,6 +591,7 @@
end
})
actor.__queueRepresentation(actorQueue[#actorQueue])
actorAssociationTable[actor] = {}
return actor
end
@ -689,6 +701,9 @@
end
function addChild(frame, actor)
if not frame or not actor then
error('uranium: frame and actor must both Exist', 2)
end
if actorsInitializing then
error('uranium: cannot create frame-child associations during actor initialization', 2)
end
@ -702,6 +717,7 @@
error('uranium: trying to add a child to an ActorFrame that isn\'t an actor; please read the first half of \'ActorFrame\'', 2)
end
actorAssociationQueue[actor.__queue] = frame.__queue
table.insert(actorAssociationTable[frame], actor)
end
local function transformQueueToTree()

View File

@ -87,6 +87,11 @@ function resetOnFrameStart(bool) end
---@param bool boolean | nil
function resetActorOnFrameStart(actor, bool) end
-- Gets every child of an ActorFrame. More accurate than :GetChildren()
---@param frame ActorFrame
---@return Actor[]
function getChildren(frame) end
---@type number
--- A simple timer. Ticks upwards at a rate of 1/sec.
---