types.Instance.rawin
Method on every
instanceTests whether key names a field or method reachable on this instance.
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 field or method name to test for |
Return value
true if key is one of the instance's own fields or one of its class's methods, false otherwise. Same result as hasindex(key).
Notes
Marked pure. Does not consult a _get metamethod, so it reports false for a key _get would otherwise answer for.
Example
class Foo { x = 1 }
let f = Foo()
println("f.rawin(\"x\") =", f.rawin("x"))
println("f.rawin(\"y\") =", f.rawin("y"))Output:
f.rawin("x") = true
f.rawin("y") = falseSee also
rawget | Reads the value stored at key on this instance, without consulting a _get metamethod. |
hasindex | Tests whether key names a field or method reachable on this instance. |
rawin | Tests whether key names a member of the class. |
| instance | class index |