Helpers is a utility module in RoClass that provides general-purpose functions for working with classes and instances.
It includes functions for cloning, checking instance types, and other common operations.
The Helpers module offers common utilities to simplify working with RoClass objects:
IsInstanceOf
)Helpers.Clone(instance: any): any
Clones an instance or table.
instance
→ The object or table to clone.Helpers.IsInstanceOf(instance: any, className: string): boolean
Checks if an instance is of a given class or inherits from it.
instance
→ The object or class instanceclassName
→ Name of the classtrue
if the instance is of the class or inherits from it, otherwise false
local Player = RoClass.new("Player"):build()
local p1 = Player.new()
local p2 = RoClass.Clone(p1)
print(p2 ~= p1) -- true
print(p2.Health == p1.Health) -- true
local Player = RoClass.GetClass("Player")
local p1 = Player.new()
print(RoClass.IsInstanceOf(p1, "Player")) -- true
print(RoClass.IsInstanceOf(p1, "Enemy")) -- false
This documentation is part of RoClass. For more examples and detailed guides, see RoClass Docs.