Skip to main content
Returns one constant from a Lua function or stack level by one-based index. target must be a function or stack level number. Invalid stack levels raise “Level out of range”. Non-function and non-number targets raise a type error expecting “function or number”. C closures raise “Lua function expected”. Indexes below 1 raise “Constant index starts at 1”, and indexes past the available constants raise “Constant index out of range”. Function and table constants are returned as nil. debug.getconstant is an alias.

Składnia

Aliasy

  • debug.getconstant

Argumenty

Zwroty

Przykład

Read a one-based Proto constant from a Lua closure.