Allow components to store any datatype
This PR adds support for non-table components. Calling Components.Model(model) will return a table that has a special marker on it that tells the World it should be unwrapped on insertion. I explicitly chose this strategy because it means that we can do not need to store this table in archetypes.
Unfortunately, we still need to store Components.Model(model) initially inside of a table because we need a way to get the component ID and Luau does not have tuples.
Could you also update the description of the PR with a brief description of how this PR achieves what it says in the title in case anyone looks back at it later?
Could you also update the description of the PR with a brief description of how this PR achieves what it says in the title in case anyone looks back at it later?
Updated the description.
@LastTalon, I started updating the docs but I'm still not sure what to call everything. As it stands, the docs for Component say that it returns a ComponentInstance, but this is not true anymore.
but this is not true anymore.
How so? It seems to me like it does.
but this is not true anymore.
How so? It seems to me like it does.
Well, it can return a ComponentInstance, if we want to consider that a ComponentInstance. But I don't think we should consider it a ComponentInstance because we don't want people interacting with it in the same way they interact with table components.
This doesn't seem complicated to me. We clearly just have two types of component instance now. What else would have you it return?
It seems to me it returns a ComponentInstance still. It's just that that type is now a union of TableComponentInstance | ValueComponentInstance.
This doesn't seem complicated to me. We clearly just have two types of component instance now. What else would have you it return?
It seems to me it returns a
ComponentInstancestill. It's just that that type is now a union ofTableComponentInstance | ValueComponentInstance.
Just updated the docs to what I believe they could potentially look like. Curious if this is what you had in mind.