From 2810c4804a6aac5234ddacc33b8bab0bf60f4e2b Mon Sep 17 00:00:00 2001 From: steve donovan Date: Tue, 5 Jul 2011 13:33:27 +0200 Subject: [PATCH] conditional fix for Penlight 0.9.5; uses loadin() if available --- ldoc.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ldoc.lua b/ldoc.lua index c267ae9..d1dd3cd 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -103,10 +103,15 @@ local function read_ldoc_config (fname) local txt,not_found = utils.readfile(fname) if txt then -- Penlight defines loadin for Lua 5.1 as well - local chunk,err = loadin(ldoc,txt) - if chunk then - local ok - ok,err = pcall(chunk) + local chunk,err + if not loadin then -- Penlight 0.9.5 + chunk,err = load(txt,nil,nil,ldoc) + else + chunk,err = loadin(ldoc,txt) + end + if chunk then + local ok + ok,err = pcall(chunk) end end if err then print('error loading config file '..fname..': '..err) end