문법
getconstant(target: function | integer, index: number | integer): any | nil별칭
debug.getconstant인수
| 이름 | 타입 | 설명 |
|---|---|---|
target | function | integer | 검사할 함수, 스택 수준 또는 프로토타입입니다. |
index | number | integer | 상수, protos, upvalue 또는 스택 슬롯 내부의 1 기반 인덱스입니다. |
반환값
| 이름 | 타입 | 설명 |
|---|---|---|
constant | any | nil | 요청된 인덱스의 상수 값이거나 누락된 경우 nil입니다. |
설명
1부터 시작하는 인덱스로 함수, 스택 수준 또는 프로토타입에서 상수를 읽습니다.
2개 파라미터로 호출합니다: target, index. 인수 표는 필수 값과 동작을 조정하는 값을 설명합니다.
constant (any | nil)을 반환합니다. 반환 표를 사용해 성공 값, nil 결과, 복구 가능한 오류를 구분하세요.
예제
자리 표시자 값을 사용하는 예제 호출입니다.
local result = getconstant(1, 1)
print(result)