Improve package lib behavior and error reporting.

This commit is contained in:
James Roseborough
2010-05-16 17:53:33 +00:00
parent fe7658e83b
commit ce13cc8621
14 changed files with 46 additions and 36 deletions

View File

@@ -132,12 +132,11 @@ local function arglists(typesets)
return ipairs(argsets)
end
local function lookup( name )
function lookup( name )
return loadstring('return '..name)()
end
local function invoke( name, arglist )
function invoke( name, arglist )
local s,c = pcall(lookup, name)
if not s then return s,c end
return pcall(c, unpack(arglist,1,arglist.n or #arglist))