{"name":"diag_stacktrace","operator":null,"title":"diag stacktrace","type":"command","url":"https://community.bistudio.com/wiki/diag_stacktrace","revid":351630,"updated":"2023-12-11T19:47:32Z","groups":["Diagnostic"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.06"}],"since":{"game":"arma3","name":"Arma 3","version":"2.06"},"arma3_since":"2.06","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns an array containing the function name, line number, scope name and all local variables in form of a hashmap.","syntaxes":[{"syntax":"diag_stacktrace","since":null,"effect":null,"exec":null,"params":[],"returns":{"type":"Array of Arrays, in format: ```sqf params [\"_functionName\", \"_lineNumber\", \"_scopeName\", \"_variablesHashmap\"]; ```","types":["Array"],"description":"_functionName: String - function name - _lineNumber: Number - line number - _scopeName: String - scope name - _variablesHashmap: HashMap - all local variables","text":"Array of Arrays, in format:\n\n```sqf\nparams [\"_functionName\", \"_lineNumber\", \"_scopeName\", \"_variablesHashmap\"];\n```\n\n- _functionName: String - function name\n- _lineNumber: Number - line number\n- _scopeName: String - scope name\n- _variablesHashmap: HashMap - all local variables"},"form":"nullary","operator":null,"left":null,"right":null}],"examples":[{"text":"```sqf\nprivate _testvar = 1;\nprivate _testother = 2;\ncall \n{\n    _testvar = 3;\n    if (_testvar == 3) then \n    {\n        _myVariable = 4;\n        hint str diag_stacktrace;\n    };\n};\n/*\n[\n    [\"\", 3, \"\", [[\"_this\", []], [\"_testother\", 2], [\"_testvar\", 3]]],\n    [\"\", 6, \"\", []],\n    [\"\", 8, \"\", [[\"_myvariable\", 4]]]\n]\n*/\n```","code":["private _testvar = 1;\nprivate _testother = 2;\ncall \n{\n\t_testvar = 3;\n\tif (_testvar == 3) then \n\t{\n\t\t_myVariable = 4;\n\t\thint str diag_stacktrace;\n\t};\n};\n/*\n[\n\t[\"\", 3, \"\", [[\"_this\", []], [\"_testother\", 2], [\"_testvar\", 3]]],\n\t[\"\", 6, \"\", []],\n\t[\"\", 8, \"\", [[\"_myvariable\", 4]]]\n]\n*/"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["arma.RPT","diag_dumpCalltraceToLog","diag_log"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Diagnostic","Introduced with Arma 3 version 2.06","Scripting Commands"]}