GameObject reference fields on Script Components (#85) #97
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/cinnabar!97
Loading…
Reference in a new issue
No description provided.
Delete branch "luau-reference-fields"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #85.
A field defaulted to the
GameObjectclass inComponent.defineregisters as aGameObject_Referencefield. From Luau it reads as the referenced GameObject userdata ornil, and accepts a GameObject ornilon write throughcomponent_set_reference, so the Reference Side Table covers cross-Scene targets. A non-GameObject value, or a destroyed GameObject, raises an error naming the field.Save, load and External Reference resolution needed no Core changes.
tests/luau/reference_test.odincovers each acceptance criterion: the.Referenceflag, write and clear visible viacomponent_reference, read-back identity, the text document holding an Object Path and resolving on load, and a reference into an unloaded Scene readingniluntil that Scene loads.Not changed: reading a reference whose same-Scene target was destroyed yields a dead userdata rather than
nil, matching every other GameObject property today.