From Lua 5.3: assert() accepts any type of error object.

This commit is contained in:
Mike Pall
2018-06-05 12:23:56 +02:00
parent 55f7082324
commit a5a89ab586
2 changed files with 6 additions and 5 deletions

View File

@@ -42,13 +42,13 @@
LJLIB_ASM(assert) LJLIB_REC(.)
{
GCstr *s;
lj_lib_checkany(L, 1);
s = lj_lib_optstr(L, 2);
if (s)
lj_err_callermsg(L, strdata(s));
else
if (L->top == L->base+1)
lj_err_caller(L, LJ_ERR_ASSERT);
else if (tvisstr(L->base+1) || tvisnumber(L->base+1))
lj_err_callermsg(L, strdata(lj_lib_checkstr(L, 2)));
else
lj_err_run(L);
return FFH_UNREACHABLE;
}