mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
From Lua 5.3: assert() accepts any type of error object.
This commit is contained in:
parent
55f7082324
commit
a5a89ab586
@ -373,6 +373,7 @@ LuaJIT supports some extensions from Lua 5.3:
|
|||||||
<li>Unicode escape <tt>'\u{XX...}'</tt> embeds the UTF-8 encoding in string literals.</li>
|
<li>Unicode escape <tt>'\u{XX...}'</tt> embeds the UTF-8 encoding in string literals.</li>
|
||||||
<li>The argument table <tt>arg</tt> can be read (and modified) by <tt>LUA_INIT</tt> and <tt>-e</tt> chunks.</li>
|
<li>The argument table <tt>arg</tt> can be read (and modified) by <tt>LUA_INIT</tt> and <tt>-e</tt> chunks.</li>
|
||||||
<li><tt>io.read()</tt> and <tt>file:read()</tt> accept formats with or without a leading <tt>*</tt>.</li>
|
<li><tt>io.read()</tt> and <tt>file:read()</tt> accept formats with or without a leading <tt>*</tt>.</li>
|
||||||
|
<li><tt>assert()</tt> accepts any type of error object.</li>
|
||||||
<li><tt>table.move(a1, f, e, t [,a2])</tt>.</li>
|
<li><tt>table.move(a1, f, e, t [,a2])</tt>.</li>
|
||||||
<li><tt>coroutine.isyieldable()</tt>.</li>
|
<li><tt>coroutine.isyieldable()</tt>.</li>
|
||||||
<li>Lua/C API extensions:
|
<li>Lua/C API extensions:
|
||||||
|
@ -42,13 +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->top == L->base+1)
|
||||||
if (s)
|
|
||||||
lj_err_callermsg(L, strdata(s));
|
|
||||||
else
|
|
||||||
lj_err_caller(L, LJ_ERR_ASSERT);
|
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;
|
return FFH_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user