Debug information about extra arguments from __call
'debug.getinfo' can return number of extra arguments added to a call by a chain of __call metavalues. That information is being used to improve error messages about errors in these extra arguments.
This commit is contained in:
@@ -204,6 +204,17 @@ do print"testing chains of '__call'"
|
||||
assert(Res[i][1] == i)
|
||||
end
|
||||
assert(Res[N + 1] == "a" and Res[N + 2] == "b" and Res[N + 3] == "c")
|
||||
|
||||
local function u (...)
|
||||
local n = debug.getinfo(1, 't').extraargs
|
||||
assert(select("#", ...) == n)
|
||||
return n
|
||||
end
|
||||
|
||||
for i = 0, N do
|
||||
assert(u() == i)
|
||||
u = setmetatable({}, {__call = u})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user