Correct the error reporting positions.

This commit is contained in:
Lefteris Chatzimparmpas 2012-11-18 23:07:56 +01:00
parent c082ae4ddc
commit 1f79e2d345

View File

@ -19,7 +19,7 @@ function _check_optional(arg, argtype)
if type(arg) ~= 'nil' then
if type(argtype) == 'string' then
if type(arg) ~= argtype then
error(argtype .. ' argument expected, got ' .. type(arg), 3)
error(argtype .. ' argument expected, got ' .. type(arg), 4)
end
elseif type(argtype) == 'table' then
local b = false
@ -27,7 +27,7 @@ function _check_optional(arg, argtype)
if type(arg) == t then b = true end
end
if b == false then
error(argtype .. ' argument expected, got ' .. type(arg), 3)
error(argtype .. ' argument expected, got ' .. type(arg), 4)
end
end
end