libs/web: add assert() statements for unresolvable function case

This commit is contained in:
Jo-Philipp Wich 2011-11-30 12:50:32 +00:00
parent c5329d85d5
commit 099e97532c

View file

@ -761,10 +761,18 @@ end
local function _call(self, ...)
local func = getfenv()[self.name]
assert(func ~= nil,
'Cannot resolve function "' .. self.name .. '". Is it misspelled or local?')
assert(type(func) == "function",
'The symbol "' .. self.name .. '" does not refer to a function but data ' ..
'of type "' .. type(func) .. '".')
if #self.argv > 0 then
return getfenv()[self.name](unpack(self.argv), ...)
return func(unpack(self.argv), ...)
else
return getfenv()[self.name](...)
return func(...)
end
end