Skip to content

ClassExists(string)

The ClassExists Lua function returns a boolean indicating whether the provided string is a class.

  • String:
    A string containing a single word that could be a class.
  • Boolean:
    The function returns a boolean.

    • True:
      The provided word is a class.
    • False:
      The provided input is not a class.

This example asks if the word “Display” is a class and returns proper feedback.

Copy CodeLua
```
return function()
-- Store a string with the class name
local className = "Display"
-- Check if the class exists and then provide proper feedback
if ClassExists(className) then
Printf("The class '%s' exists", className)
else
Printf("The class '%s' does not exists", className)
end

end