Object is a utility module in RoClass that provides helper functions to work with instances and classes.
It allows you to check types, get class names, and convert instances to strings safely.
The Object module provides common helpers for class instances:
IsA
)GetClassName
)ToString
)These helpers are fully compatible with RoClass-created classes and standard Roblox instances.
Object.IsA(instance: any, className: string): boolean
Checks if an instance is of the given class or inherits from it.
instance
→ The object or class instance to check.className
→ Name of the class.true
if the instance is of the given class, otherwise false
.Object.GetClassName(instance: any): string
Returns the class name of an instance.
instance
→ The object or class instance.Object.ToString(instance: any): string
Converts an instance to a string representation.
instance
→ The object or class instance.local Player = RoClass.new("Player"):build()
local p1 = Player.new()
print(Object.IsA(p1, "Player")) -- true
print(Object.IsA(p1, "Enemy")) -- false
print(Object.GetClassName(p1)) -- "Player"
print(Object.ToString(p1)) -- "Player: <table address>"
This documentation is part of RoClass. For more examples and detailed guides, see RoClass Docs.