lua-users home
lua-l archive

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


> Unfortunately, it is not possible with assert, you *must* pass a string. 
> I think it can be great to also have assert working like error so the 

This is supported in Lua 5.3.0 (work3).

For Lua 5.2, you can simply redefine assert:

function assert(cond,...)
	if cond then
		return cond,...
	else
		error(...)
	end
end

This is how assert is implemented in 5.3.