Quirrel4.41.0

types.Instance.rawin

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

Tests 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

keyanythe 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

examples/types/instance/rawin.nut
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") = false

See also

rawgetReads the value stored at key on this instance, without consulting a _get metamethod.
hasindexTests whether key names a field or method reachable on this instance.
rawinTests whether key names a member of the class.
instanceclass index