RoClass

Object

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.


Table of Contents


Overview

The Object module provides common helpers for class instances:

These helpers are fully compatible with RoClass-created classes and standard Roblox instances.


API

Object.IsA(instance: any, className: string): boolean

Checks if an instance is of the given class or inherits from it.

Object.GetClassName(instance: any): string

Returns the class name of an instance.

Object.ToString(instance: any): string

Converts an instance to a string representation.


Examples

Checking instance type

local Player = RoClass.new("Player"):build()
local p1 = Player.new()

print(Object.IsA(p1, "Player")) -- true
print(Object.IsA(p1, "Enemy"))  -- false

Getting class name

print(Object.GetClassName(p1)) -- "Player"

Converting to string

print(Object.ToString(p1)) -- "Player: <table address>"


This documentation is part of RoClass. For more examples and detailed guides, see RoClass Docs.