ReferenceDebug

debug.getupvaluecount

Counts a function's upvalues. The count is the number of entries debug.getupvalues returns for the same argument, so a C function reports zero.

Syntax

debug.getupvaluecount(target: function | number) -> number

Parameters

ParameterTypeDescription
targetfunction or numberA function or a stack level.

Returns

TypeDescription
numberHow many upvalues debug.getupvalues reports for it.

Example

local value = 1
local function read() return value end
print(debug.getupvaluecount(read))

These are Game executor contracts. Check build requirements and session lifetimes before using them.