getobjflags
Global, available without an import
Returns the engine flag bits stored on obj's reference.
Parameters
obj | any | any value |
Return value
An int bit mask. The only bit currently defined is getconsttable().SQOBJ_FLAG_IMMUTABLE, set by freeze; a value that was never frozen reports 0.
Notes
The flags belong to the reference passed in, not to the underlying table or array: after let f = freeze(t), getobjflags(f) is nonzero but getobjflags(t) still reports 0, because t names the object through its own, never-frozen reference. See freeze for what that split means for writes.
Example
let t = {}
println("getobjflags(t) =", getobjflags(t))
let f = freeze(t)
println("getobjflags(f) =", getobjflags(f))
println("getobjflags(t) =", getobjflags(t)) // t's own reference is unaffected by freezing f
println("getobjflags(5) =", getobjflags(5)) // any type is accepted; a scalar simply reports 0Output:
getobjflags(t) = 0
getobjflags(f) = 1
getobjflags(t) = 0
getobjflags(5) = 0See also
freeze | Returns a reference to obj with the immutable flag set. |
getconsttable | Returns the const table. |
| globals | module index |