Skip to content

Commit

Permalink
Fixed errors in assert macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincox committed Jun 7, 2012
1 parent 92fa34b commit 9123863
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/pl/utils.lua
Expand Up @@ -477,7 +477,7 @@ end
-- @usage assert_arg(n,val,'string',path.isdir,'not a directory') -- @usage assert_arg(n,val,'string',path.isdir,'not a directory')
function utils.assert_arg (n,val,tp,verify,msg,lev) function utils.assert_arg (n,val,tp,verify,msg,lev)
if type(val) ~= tp then if type(val) ~= tp then
error(("argument %d expected a '%s', got a '%s'"):format(n,tp,type(val)),2) error(("argument %d expected a '%s', got a '%s'"):format(n,tp,type(val)),lev or 2)
end end
if verify and not verify(val) then if verify and not verify(val) then
error(("argument %d: '%s' %s"):format(n,val,msg),lev or 2) error(("argument %d: '%s' %s"):format(n,val,msg),lev or 2)
Expand All @@ -489,7 +489,7 @@ end
-- @param val a value that must be a string -- @param val a value that must be a string
-- @raise val must be a string -- @raise val must be a string
function utils.assert_string (n,val) function utils.assert_string (n,val)
utils.assert_arg(n,val,'string',nil,nil,nil,3) utils.assert_arg(n,val,'string',nil,nil,3)
end end


local err_mode = 'default' local err_mode = 'default'
Expand Down

0 comments on commit 9123863

Please sign in to comment.