Quirrel4.41.0

instance

Methods on every class instance.

Call these with .$

An instance's members and its built-in methods share one namespace, and a member wins. An instance that declares a field called rawget, tostring or weakref hides the method of that name, and the ordinary call then fails with attempt to call 'string' or whatever the field happens to hold.

Writing the call as obj.$rawget(key) reaches the built-in type method directly and never looks at the members, so the class declaration cannot break it. Plain obj.rawget(key) is fine for an instance of a class you wrote yourself.

See the .$ operator and types.Table.

Functions

cloneclone(): anyCreates a new instance of the same class, copying this instance's own field values into it.
getclasspure instance.getclass(): anyReturns the class this instance was constructed from.
getfuncinfosinstance.getfuncinfos(): anyDescribes this instance's class's _call metamethod, the same way function.getfuncinfos describes a plain function.
getmetamethodinstance.getmetamethod(name: string): anyLooks up one of this instance's class's metamethods by name, without triggering it.
hasindexpure instance.hasindex(key): anyTests whether key names a field or method reachable on this instance.
is_frozenis_frozen(): anyReports whether this reference to the instance was frozen with freeze().
rawgetpure instance.rawget(key): anyReads the value stored at key on this instance, without consulting a _get metamethod.
rawinpure instance.rawin(key): anyTests whether key names a field or method reachable on this instance.
rawsetinstance.rawset(key, value): anyReplaces the value stored at an existing field of this instance, without consulting a _newslot metamethod.
swapinstance.swap(key1, key2): anySwaps the values stored at two of this instance's fields.
tostringtostring(): anyConverts the instance to a string.
weakrefweakref(): anyReturns a weak reference to the instance.