Skip to content
DiagnosticsReferenceNew · 0.744

getthreadcapacity

Read the current thread's allocated Luau stack capacity.

Details#

Reports the number of value slots represented by the current Luau state's allocated stack range. It is an allocation-capacity reading, not the number of active values or a count of runnable threads.

Signature#

Luau
getthreadcapacity(): number

Returns#

A nonnegative slot count as a number; 0 when a usable stack range is unavailable.

Examples#

Display an aggregate stack-capacity reading

Luau
local slots = getthreadcapacity()
assert(type(slots) == "number" and slots >= 0)
print("Allocated Luau stack slots:", slots)

Notes#

  • The result is a count of stack slots, not bytes or threads.