This annotation is intended for complex cases and is primarily designed to be used by the built-in annotations.
Overview
self_class_name marks a colon method such as Entity:GetClass that returns the class name of the object it is called on. When you compare that name with a class, or pass it to a base test such as scripted_ents.IsBasedOn, GLuaLS narrows the object to that class.
Other methods that return a string, like ent:GetOwnerClass(), do not narrow the object.
The official annotations already mark Entity:GetClass.
Syntax
@return line. The method must take no arguments.
Example
Keep it narrow
Only use it on a method that returns the object’s own Lua class name.Panel:GetClassName returns the engine panel class, such as Label, not the Lua class, so it is not marked.
See also
@call_arg: marks the class name and base arguments ofIsBasedOn@self_guard: a method that proves the object it is called on is valid