mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 07:34:07 +00:00
allow assert to take a table object as error
This commit is contained in:
parent
b708297aba
commit
bdc40c6ebf
@ -42,11 +42,13 @@
|
|||||||
|
|
||||||
LJLIB_ASM(assert) LJLIB_REC(.)
|
LJLIB_ASM(assert) LJLIB_REC(.)
|
||||||
{
|
{
|
||||||
GCstr *s;
|
|
||||||
lj_lib_checkany(L, 1);
|
lj_lib_checkany(L, 1);
|
||||||
s = lj_lib_optstr(L, 2);
|
if (L->base+1 < L->top) {
|
||||||
if (s)
|
if (tvisstr(L->top-1))
|
||||||
lj_err_callermsg(L, strdata(s));
|
lj_err_callermsg(L, strVdata(L->top-1));
|
||||||
|
else
|
||||||
|
lj_err_run(L);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
lj_err_caller(L, LJ_ERR_ASSERT);
|
lj_err_caller(L, LJ_ERR_ASSERT);
|
||||||
return FFH_UNREACHABLE;
|
return FFH_UNREACHABLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user