debug.isvalidlevel
Checks whether a stack level points to a valid debug frame.
Syntax
debug.isvalidlevel(level: number) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
level | number | The level value used by the call. |
Returns
| Type | Description |
|---|---|
boolean | The boolean result of the check. |
Description
debug.isvalidlevel is part of the Debug library. The debug library exposes the internals of the active Luau state, including protos, constants, upvalues and stack frames.
The call is a predicate: it inspects the current state and returns a boolean without modifying anything.
The aliases validlevel(level) resolve to the same implementation.
Example
print(debug.isvalidlevel(1), validlevel(1))
Notes
- Aliases:
validlevel(level). - Writing protos, constants or upvalues can corrupt a running function; test changes carefully.