From: Jo-Philipp Wich Date: Tue, 6 Dec 2011 11:10:08 +0000 (+0000) Subject: luci-0.10: merge r8018 X-Git-Tag: 0.10.0~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=63b1f034f78a1e0162f990ef48333615b89903a1;p=oweals%2Fluci.git luci-0.10: merge r8018 --- diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 911f2f4e9..7c77f2e97 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -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