github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/debug/testdata/traceback.lua (about) 1 local function h() 2 tb = debug.traceback("", 2) 3 end 4 5 local function g() 6 return h() 7 end 8 9 local function f() 10 g() 11 end 12 13 f() 14 15 iter = string.gmatch(tb, ".-\n") 16 assert(iter() == "\n") 17 assert(iter() == "stack traceback:\n") 18 x = iter() 19 assert(x == " testdata/traceback.lua:10: in local 'f'\n" or " testdata\\traceback.lua:10: in local 'f'\n")