Quirrel4.41.0

types.Class.rawin

Method on every class
pure class.rawin(key): any

Tests whether key names a member of the class.

The binding carries no declaration string, so the VM cannot report parameter names. The names above are from this page; the types and attributes still come from the VM. The VM also cannot tell an optional parameter from a variadic tail here, so read the brackets and any trailing ... from the prose below, not from the signature.

Parameters

keyanythe member name to test for

Return value

true if the class has an own member called key, false otherwise. Same result as hasindex(key).

Notes

Marked pure. Inherited members count too, since a derived class copies every member of its base into its own table when it is declared.

Example

examples/types/class/rawin.nut
class Animal { legs = 4 }
class Dog(Animal) {}
println("Dog.rawin(\"legs\") =", Dog.rawin("legs"))
println("Dog.rawin(\"tail\") =", Dog.rawin("tail"))
Output:
Dog.rawin("legs") = true
Dog.rawin("tail") = false

See also

rawgetReads the value stored at key in the class's own member table.
hasindexTests whether key names a member of the class.
rawinTests whether key names a field or method reachable on this instance.
classclass index