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.

Sintaks

Alias

  • debug.getconstant

Argumen

Return

Contoh

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