github.com/arnodel/golua@v0.0.0-20230215163904-e0b5347eaaa1/runtime/lua/names.lua (about)

     1  -- A best effort attempt is made to name anonymous functions
     2  local function myname() print(debug.getinfo(2).name) end
     3  
     4  x = function() myname() end
     5  x()
     6  --> =x
     7  
     8  t = {}
     9  t.foo = function() myname() end
    10  t.foo()
    11  --> =foo
    12  
    13  t = {
    14      hello = function() myname() end
    15  }
    16  t.hello()
    17  --> =hello