aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib_base.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib_base.c b/src/lib_base.c
index bac49a0b..2672a076 100644
--- a/src/lib_base.c
+++ b/src/lib_base.c
@@ -373,8 +373,11 @@ static const char *reader_func(lua_State *L, void *ud, size_t *size)
373 373
374LJLIB_CF(load) 374LJLIB_CF(load)
375{ 375{
376 GCstr *name = lj_lib_optstr(L, 2); 376 GCstr *name;
377 if (L->base < L->top && (tvisstr(L->base) || tvisnumber(L->base)))
378 return lj_cf_loadstring(L);
377 lj_lib_checkfunc(L, 1); 379 lj_lib_checkfunc(L, 1);
380 name = lj_lib_optstr(L, 2);
378 lua_settop(L, 3); /* Reserve a slot for the string from the reader. */ 381 lua_settop(L, 3); /* Reserve a slot for the string from the reader. */
379 return load_aux(L, 382 return load_aux(L,
380 lua_load(L, reader_func, NULL, name ? strdata(name) : "=(load)")); 383 lua_load(L, reader_func, NULL, name ? strdata(name) : "=(load)"));