conditional fix for Penlight 0.9.5; uses loadin() if available
This commit is contained in:
parent
3169b6482f
commit
2810c4804a
13
ldoc.lua
13
ldoc.lua
|
@ -103,10 +103,15 @@ local function read_ldoc_config (fname)
|
||||||
local txt,not_found = utils.readfile(fname)
|
local txt,not_found = utils.readfile(fname)
|
||||||
if txt then
|
if txt then
|
||||||
-- Penlight defines loadin for Lua 5.1 as well
|
-- Penlight defines loadin for Lua 5.1 as well
|
||||||
local chunk,err = loadin(ldoc,txt)
|
local chunk,err
|
||||||
if chunk then
|
if not loadin then -- Penlight 0.9.5
|
||||||
local ok
|
chunk,err = load(txt,nil,nil,ldoc)
|
||||||
ok,err = pcall(chunk)
|
else
|
||||||
|
chunk,err = loadin(ldoc,txt)
|
||||||
|
end
|
||||||
|
if chunk then
|
||||||
|
local ok
|
||||||
|
ok,err = pcall(chunk)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if err then print('error loading config file '..fname..': '..err) end
|
if err then print('error loading config file '..fname..': '..err) end
|
||||||
|
|
Loading…
Reference in New Issue