Skip to content

Commit f89bbea

Browse files
committed
Fix backward compatibility with Lua 5.1 - coxpcall required...
Resolves "attempt to yield across metamethod/C-call boundary" errors when running Wsapi apps such as Orbit on Lua < 5.2
1 parent 810ecd0 commit f89bbea

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/wsapi/common.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ local lfs = require "lfs"
1818
local tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile =
1919
tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile
2020

21+
if _VERSION < "Lua 5.2" then
22+
local coxpcall = require "coxpcall"
23+
pcall = coxpcall.pcall
24+
xpcall = coxpcall.xpcall
25+
end
26+
2127
local package = package
2228

2329
local _, ringer = pcall(require, "wsapi.ringer")

0 commit comments

Comments
 (0)