diff options
-rw-r--r-- | doc/extensions.html | 1 | ||||
-rw-r--r-- | src/lib_base.c | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/doc/extensions.html b/doc/extensions.html index 55c4b704..7379041d 100644 --- a/doc/extensions.html +++ b/doc/extensions.html | |||
@@ -373,6 +373,7 @@ LuaJIT supports some extensions from Lua 5.3: | |||
373 | <li>Unicode escape <tt>'\u{XX...}'</tt> embeds the UTF-8 encoding in string literals.</li> | 373 | <li>Unicode escape <tt>'\u{XX...}'</tt> embeds the UTF-8 encoding in string literals.</li> |
374 | <li>The argument table <tt>arg</tt> can be read (and modified) by <tt>LUA_INIT</tt> and <tt>-e</tt> chunks.</li> | 374 | <li>The argument table <tt>arg</tt> can be read (and modified) by <tt>LUA_INIT</tt> and <tt>-e</tt> chunks.</li> |
375 | <li><tt>io.read()</tt> and <tt>file:read()</tt> accept formats with or without a leading <tt>*</tt>.</li> | 375 | <li><tt>io.read()</tt> and <tt>file:read()</tt> accept formats with or without a leading <tt>*</tt>.</li> |
376 | <li><tt>assert()</tt> accepts any type of error object.</li> | ||
376 | <li><tt>table.move(a1, f, e, t [,a2])</tt>.</li> | 377 | <li><tt>table.move(a1, f, e, t [,a2])</tt>.</li> |
377 | <li><tt>coroutine.isyieldable()</tt>.</li> | 378 | <li><tt>coroutine.isyieldable()</tt>.</li> |
378 | <li>Lua/C API extensions: | 379 | <li>Lua/C API extensions: |
diff --git a/src/lib_base.c b/src/lib_base.c index d61e8762..1cd83058 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -42,13 +42,13 @@ | |||
42 | 42 | ||
43 | LJLIB_ASM(assert) LJLIB_REC(.) | 43 | LJLIB_ASM(assert) LJLIB_REC(.) |
44 | { | 44 | { |
45 | GCstr *s; | ||
46 | lj_lib_checkany(L, 1); | 45 | lj_lib_checkany(L, 1); |
47 | s = lj_lib_optstr(L, 2); | 46 | if (L->top == L->base+1) |
48 | if (s) | ||
49 | lj_err_callermsg(L, strdata(s)); | ||
50 | else | ||
51 | lj_err_caller(L, LJ_ERR_ASSERT); | 47 | lj_err_caller(L, LJ_ERR_ASSERT); |
48 | else if (tvisstr(L->base+1) || tvisnumber(L->base+1)) | ||
49 | lj_err_callermsg(L, strdata(lj_lib_checkstr(L, 2))); | ||
50 | else | ||
51 | lj_err_run(L); | ||
52 | return FFH_UNREACHABLE; | 52 | return FFH_UNREACHABLE; |
53 | } | 53 | } |
54 | 54 | ||