diff options
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.306 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.307 2014/11/10 14:25:52 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -388,9 +388,10 @@ static int luaB_assert (lua_State *L) { | |||
388 | if (lua_toboolean(L, 1)) /* condition is true? */ | 388 | if (lua_toboolean(L, 1)) /* condition is true? */ |
389 | return lua_gettop(L); /* return all arguments */ | 389 | return lua_gettop(L); /* return all arguments */ |
390 | else { /* error */ | 390 | else { /* error */ |
391 | if (lua_isnone(L, 2)) /* no error message? */ | 391 | luaL_checkany(L, 1); /* there must be a condition */ |
392 | lua_pushliteral(L, "assertion failed!"); /* use standard message */ | 392 | lua_remove(L, 1); /* remove it */ |
393 | lua_remove(L, 1); /* remove the condition (if there is one...) */ | 393 | lua_pushliteral(L, "assertion failed!"); /* default message */ |
394 | lua_settop(L, 1); /* leave only message (default if no other one) */ | ||
394 | return luaB_error(L); /* call 'error' */ | 395 | return luaB_error(L); /* call 'error' */ |
395 | } | 396 | } |
396 | } | 397 | } |