From 8d528e019981e923d141b4cb7d849e6d9d2ec98d Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Sun, 16 May 2021 18:25:59 +0200 Subject: [PATCH] allow to use a lua without debug library --- http/bit.lua | 2 +- http/h2_error.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/http/bit.lua b/http/bit.lua index d4a1f848..3ab2650f 100644 --- a/http/bit.lua +++ b/http/bit.lua @@ -11,7 +11,7 @@ This means we can ignore the differences between bit libraries. if _VERSION ~= "Lua 5.1" then -- Lua 5.3+ has built-in bit operators, wrap them in a function. -- Use debug.getinfo to get correct file+line numbers for loaded snippet - local info = debug.getinfo(1, "Sl") + local info = debug and debug.getinfo(1, "Sl") or { currentline = 14 } local has_bitwise, bitwise = pcall(load(("\n"):rep(info.currentline+1)..[[return { band = function(a, b) return a & b end; bor = function(a, b) return a | b end; diff --git a/http/h2_error.lua b/http/h2_error.lua index 27e2020d..aa4d321e 100644 --- a/http/h2_error.lua +++ b/http/h2_error.lua @@ -52,7 +52,7 @@ function http_error_methods:new_traceback(message, stream_error, lvl) if lvl ~= 0 then -- COMPAT: should be passing `nil` message (not the empty string) -- see https://github.com/keplerproject/lua-compat-5.3/issues/16 - e.traceback = debug.traceback("", lvl) + e.traceback = debug and debug.traceback("", lvl) or "no debug.traceback" end return self:new(e)