Make Value Objects Inherit From Something

So, as of right now all value objects only inherit from instance, so unlike with parts you can’t do value:IsA(“BaseValue”), and it would just be really nice to have a base value object to check for in case something we’re doing has multiple value objects involved that we’re checking for.

2 Likes
if string.sub(val.ClassName, -5) == "Value" then
-- Is a value
end

[quote] if string.sub(val.ClassName, -5) == "Value" then -- Is a value end [/quote]

yeah that’s a way to do it

I think wheatlies was just bored and decided to write his thanks in free form poetry

and I think ceaselesssoul must have thought he was being sarcastic when I don’t think he was

It would be nice if we could have a more official method to check if it is a class, though.

[quote] if string.sub(val.ClassName, -5) == "Value" then -- Is a value end [/quote]
Wouldn’t it be better to use this?

if string.find(val.ClassName,"Value") then
---
end

That code seems a little reliant on Roblox naming every value instance they have with Value at the end.

[quote] if string.sub(val.ClassName, -5) == "Value" then -- Is a value end [/quote]
Wouldn’t it be better to use this?

if string.find(val.ClassName,"Value") then
---
end

That code seems a little reliant on Roblox naming every value instance they have with Value at the end.[/quote]
What does it matter? Why would Value go first? ValueObject just sounds wrong. ObjectValue sounds better. You won’t really encounter any issues if roblox cares about consistency at all which they do talk about a lot.

If they had consistency you’d think that the value objects, like parts, would all inherit from a base object.

Well why would they inherit from a generic value object? There’d be nothing to inherit. The only difference from Instance is .Value and .Changed being fired whenever the value changes. You couldn’t inherit the value property itself because you’d need to define a type for it in the generic value object which would be the same in all objects that inherit from it or otherwise it’s not really inheriting from that object and there’s no point. And I’m pretty sure the custom .Changed is tailored specifically to the types of values in each value object, so you couldn’t inherit that either. There’s nothing to inherit, so there’s no point. Either make your own custom IsA() function to return true for “ValueObject” if you pass it a value object or just use what woot posted.

Classes that have subclasses, but no members:

  • BasePlayerGui
  • BodyMover
  • CharacterAppearance
  • Clothing
  • GuiBase
  • GuiLabel
  • LayerCollector
  • HandlesBase
  • ManualSurfaceJointInstance
  • LuaSourceContainer
  • GenericSettings
2 Likes