Correct Cleanup example: Change OnSet to OnAdd

`jecs.OnSet` no longer exists. This should be `jecs.OnAdd` instead, which does exist.
This commit is contained in:
Madison 2025-12-07 15:41:10 -08:00 committed by GitHub
parent 353a7992de
commit b30b3910e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,8 +13,8 @@ world:set(Model, jecs.OnRemove, function(entity)
model:Destroy() model:Destroy()
end) end)
world:set(Model, jecs.OnSet, function(entity, model) world:set(Model, jecs.OnAdd, function(entity, id, model)
-- OnSet is invoked after the data has been assigned. -- OnAdd is invoked after the data has been assigned.
-- It also returns the data for faster access. -- It also returns the data for faster access.
-- There may be some logic to do some side effects on reassignments -- There may be some logic to do some side effects on reassignments
model:SetAttribute("entityId", entity) model:SetAttribute("entityId", entity)