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

     1  -- error in message handler, we eventually bail out
     2  print(xpcall(error, error, "foo"))
     3  --> =false	error in error handling
     4  
     5  
     6  do
     7      -- The file doesn't exist but this is not an error!  This tests that the Go
     8      -- error is recognized as a *os.PathError and turned to a value.
     9      print(io.open("nosuchfile"))
    10      --> ~nil
    11  
    12      -- The file doesn't exist but this is not an error!  This tests that the Go
    13      -- error is recognized as a *os.LinkError and turned to a value.
    14      print(os.rename("nosuchfile", "newname"))
    15      --> ~nil
    16  end
    17  
    18  local a
    19   for i=1,'a' do 
    20   print(i) 
    21  end
    22  --> ~!!! runtime: error: luatest:\d+: 'for' limit: expected number, got string