debug

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.


요약


API 참조
함수
traceback
debug.traceback(
message:string, level:number
매개 변수
message:string
level:number
기본값: 1
반환
코드 샘플
디버그 추적

traceback
debug.traceback(
thread:coroutine, message:string, level:number
매개 변수
thread:coroutine
message:string
level:number
기본값: 1
반환
코드 샘플
스레드의 디버그 추적

info
debug.info(
level:number, options:string
매개 변수
level:number
options:string
반환
코드 샘플
레벨별 디버그 정보

info
debug.info(
function:function, options:string
매개 변수
function:function
options:string
반환
코드 샘플
함수별 디버그 정보

info
debug.info(
thread:coroutine, level:number, options:string
매개 변수
thread:coroutine
level:number
options:string
반환
코드 샘플
스레드별 디버그 정보

profilebegin
debug.profilebegin(label:string):()
매개 변수
label:string
반환
()
코드 샘플
디버그 프로파일 시작
local function buildGrid(size)
debug.profilebegin("BuildGrid")
local grid = table.create(size * size, 0)
debug.profileend()
return grid
end
print(#buildGrid(32)) --> 1024

profileend
debug.profileend():()
반환
()
코드 샘플
디버그 프로파일 종료
debug.profilebegin("Outer")
\
debug.profilebegin("Inner")
\
-- 여기서 수행된 작업은 두 레이블 아래에서 시간 측정됩니다.
\
debug.profileend() -- "Inner"를 닫습니다.
\
debug.profileend() -- "Outer"를 닫습니다.

getmemorycategory
debug.getmemorycategory():string
반환
코드 샘플
메모리 카테고리 디버그 가져오기
local category = debug.getmemorycategory()
print(type(category)) --> string
-- 카테고리는 스레드를 따르므로, 새 카테고리는 이 카테고리와 다를 수 있습니다.
local previous = debug.setmemorycategory("Pathfinding")
print(debug.getmemorycategory()) --> Pathfinding
debug.setmemorycategory(previous)

setmemorycategory
debug.setmemorycategory(tag:string):string
매개 변수
tag:string
반환
코드 샘플
디버그 메모리 카테고리 설정
local original = debug.setmemorycategory("MapGeneration")
print(debug.getmemorycategory()) --> MapGeneration
-- 여기에서 할당된 내용은 개발자 콘솔의 "MapGeneration" 아래에 나열됩니다
local tiles = table.create(1000, 0)
-- 반환 값은 이전 카테고리이므로 복원할 수 있습니다
print(debug.setmemorycategory(original) == "MapGeneration") --> true
print(#tiles) --> 1000

resetmemorycategory
debug.resetmemorycategory():()
반환
()
코드 샘플
디버그 메모리 카테고리 재설정
local automatic = debug.getmemorycategory()
debug.setmemorycategory("Spawning")
print(debug.getmemorycategory()) --> Spawning
debug.resetmemorycategory()
print(debug.getmemorycategory() == automatic) --> true

dumpcodesize
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에서만 호출할 수 있습니다.

©2026 Roblox Corporation. Roblox 및 Roblox 로고, 'Powering Imagination'은 미국 및 기타 국가 내 당사의 등록 및 미등록 상표입니다.