Prints a stack trace at the current code location. See also [method get_stack]. The output in the console may look like the following: [codeblock lang=text] Frame 0 - res://test.gd:16 in function '_process' [/codeblock] [b]Note:[/b] This function only works if the running instance is connected to a debugging server (i.e. an editor instance). [method print_stack] will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server. [b]Note:[/b] Calling this function from a [Thread] is not supported. Doing so will instead print the thread ID.
Mengembalikan sebuah array dari dictionary yang mewakili call stack saat ini. Lihat jga [method print_stack]. [codeblock] func _ready(): foo() func foo(): bar() func bar(): print(get_stack()) [/codeblock] Mulai dari [code]_ready()[/code], [code]bar()[/code] akan menampilkan: [codeblock] [{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}] [/codeblock] [b]Catatan:[/b] Fungsi ini anya bekerja jika instance yang sedang berjalan terkoneksi dengan server debugging (contohnya instance editor). [method get_stack] tidak akan bekerja dalam proyek-proyek yang diekspor dalam mode rilis, atau dalam proyek-proyek yang diekspor dalam mode debug jika tidak dihubungkan ke server debugging. [b]Catatan:[/b] Memanggil fungsi ini dari sebuah [Thread] tidak didukung. Melakukan ini hanya akan mengembalikan sebuah array kosong.
The output in the console may look like the following:
[codeblock lang=text]
Frame 0 - res://test.gd:16 in function '_process'
[/codeblock]
[b]Note:[/b] This function only works if the running instance is connected to a debugging server (i.e. an editor instance). [method print_stack] will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server.
[b]Note:[/b] Calling this function from a [Thread] is not supported. Doing so will instead print the thread ID.
[codeblock]
func _ready():
foo()
func foo():
bar()
func bar():
print(get_stack())
[/codeblock]
Mulai dari [code]_ready()[/code], [code]bar()[/code] akan menampilkan:
[codeblock]
[{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]
[/codeblock]
[b]Catatan:[/b] Fungsi ini anya bekerja jika instance yang sedang berjalan terkoneksi dengan server debugging (contohnya instance editor). [method get_stack] tidak akan bekerja dalam proyek-proyek yang diekspor dalam mode rilis, atau dalam proyek-proyek yang diekspor dalam mode debug jika tidak dihubungkan ke server debugging.
[b]Catatan:[/b] Memanggil fungsi ini dari sebuah [Thread] tidak didukung. Melakukan ini hanya akan mengembalikan sebuah array kosong.