types.Class.rawin
Method on every
classTests 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
key | any | the 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
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") = falseSee also
rawget | Reads the value stored at key in the class's own member table. |
hasindex | Tests whether key names a member of the class. |
rawin | Tests whether key names a field or method reachable on this instance. |
| class | class index |