lua-users home
lua-l archive

Confusing assert() message

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, list!
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> assert(table.remove({}))
stdin:1: bad argument #1 to 'assert' (value expected)
stack traceback:
 [C]: in function 'assert'
 stdin:1: in main chunk
 [C]: ?
> assert(table.remove({}), "error")
stdin:1: error
stack traceback:
 [C]: in function 'assert'
 stdin:1: in main chunk
 [C]: ?
I think that assert() should treat "no return value" from C functions
as nil. Calls to assert() without arguments should be rare enough to
be irrelevant from the error message point of view.
Alexander.

AltStyle によって変換されたページ (->オリジナル) /