debug
*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.
요약
함수
profilebegin(label: string):() |
profileend():() |
setmemorycategory(tag: string):string |
resetmemorycategory():() |
dumpcodesize():() |
API 참조
함수
traceback
traceback
info
info
info
profilebegin
profileend
debug. profileend():()
반환
()
코드 샘플
디버그 프로파일 종료
debug.profilebegin("Outer")
\
debug.profilebegin("Inner")
\
-- 여기서 수행된 작업은 두 레이블 아래에서 시간 측정됩니다.
\
debug.profileend() -- "Inner"를 닫습니다.
\
debug.profileend() -- "Outer"를 닫습니다.getmemorycategory
반환
코드 샘플
메모리 카테고리 디버그 가져오기
local category = debug.getmemorycategory()
print(type(category)) --> string
-- 카테고리는 스레드를 따르므로, 새 카테고리는 이 카테고리와 다를 수 있습니다.
local previous = debug.setmemorycategory("Pathfinding")
print(debug.getmemorycategory()) --> Pathfinding
debug.setmemorycategory(previous)setmemorycategory
매개 변수
반환
코드 샘플
디버그 메모리 카테고리 설정
local original = debug.setmemorycategory("MapGeneration")
print(debug.getmemorycategory()) --> MapGeneration
-- 여기에서 할당된 내용은 개발자 콘솔의 "MapGeneration" 아래에 나열됩니다
local tiles = table.create(1000, 0)
-- 반환 값은 이전 카테고리이므로 복원할 수 있습니다
print(debug.setmemorycategory(original) == "MapGeneration") --> true
print(#tiles) --> 1000resetmemorycategory
debug. resetmemorycategory():()
반환
()
코드 샘플
디버그 메모리 카테고리 재설정
local automatic = debug.getmemorycategory()
debug.setmemorycategory("Spawning")
print(debug.getmemorycategory()) --> Spawning
debug.resetmemorycategory()
print(debug.getmemorycategory() == automatic) --> truedumpcodesize
debug. dumpcodesize():()
반환
()
코드 샘플
디버그 덤프 코드 크기
-- debug.dumpcodesize()는 Studio Command Bar에서만 작동하며, 여기서 출력에
-- 네이티브 스크립트당 하나의 테이블로 보고서를 출력합니다. 가장 큰 함수가 먼저:
-- # 네이티브 코드 크기 분석
-- <n> 스크립트, <n> 함수, <n> KB 메모리, 256 MB 코드 크기 제한
-- ## <script name>
-- <n> 함수, <n> KB 메모리
-- | 함수 | 줄 | 네이티브 코드 크기 | 네이티브 코드 크기 (%) |
-- --!native로 시작하고 실행된 스크립트만 보고서에 나타납니다.
-- 스크립트에서 호출하면 오류가 발생하며, pcall이 이를 포착합니다.
local ok, message = pcall(debug.dumpcodesize)
print(ok) --> false
print(message) --> dumpcodesize는 CommandBar에서만 호출할 수 있습니다.