AcediaDocumentation

debug.getconstant

Reads one Lua constant by its index.

Constant indices start at 1 and refer to the compiler's constant array, not source-code order.

debug.getconstant(subject: function | number, index: number): any

Parameters

ParameterTypeDescription
subjectfunction | numberLua function or reachable stack level. C functions are rejected by prototype readers.
indexnumberOne-based constant or upvalue index.

Errors: An out-of-range index raises an error.

Aliases: getconstant.

On this page