github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/runtime/lua/debuginfo.lua (about) 1 -- Test the DebugInfo() method of continuations 2 3 function foo() 4 print(debug.traceback("in a function")) 5 end 6 foo() 7 --> =in a function 8 --> =in function foo (file luatest:4) 9 --> =in function <main chunk> (file luatest:6) 10 11 local t = {} 12 debug.setmetatable(t, {__tostring=function() 13 print(debug.traceback("TOSTRING")) 14 return "HAHA" 15 end}) 16 17 print(t) 18 --> =TOSTRING 19 --> =in function __tostring (file luatest:13) 20 --> =in function tostring (file [Go]) 21 --> =in function print (file [Go]) 22 --> =in function <main chunk> (file luatest:17) 23 --> =HAHA 24 25 -- Test debug info for a function 26 27 print(debug.getinfo(print).name) 28 --> =print 29 print(debug.getinfo(foo).name) 30 --> =foo