diff options
author | Li Jin <dragon-fly@qq.com> | 2020-07-18 16:45:50 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-07-18 16:45:50 +0800 |
commit | 8c596dc1efa8a1267c222b168a4de9c8ba254760 (patch) | |
tree | 699c748e101a48ae267b5f7b19adbfea15f3934e /src/lua/lstate.c | |
parent | 8ab0038c09a79fa8401bb10b7a31d03ef5380417 (diff) | |
download | yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.gz yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.bz2 yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.zip |
fix issue for using return statement with export.
Diffstat (limited to 'src/lua/lstate.c')
-rw-r--r-- | src/lua/lstate.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lua/lstate.c b/src/lua/lstate.c index 4434211..28853dc 100644 --- a/src/lua/lstate.c +++ b/src/lua/lstate.c | |||
@@ -318,9 +318,10 @@ static void close_state (lua_State *L) { | |||
318 | 318 | ||
319 | 319 | ||
320 | LUA_API lua_State *lua_newthread (lua_State *L) { | 320 | LUA_API lua_State *lua_newthread (lua_State *L) { |
321 | global_State *g = G(L); | 321 | global_State *g; |
322 | lua_State *L1; | 322 | lua_State *L1; |
323 | lua_lock(L); | 323 | lua_lock(L); |
324 | g = G(L); | ||
324 | luaC_checkGC(L); | 325 | luaC_checkGC(L); |
325 | /* create new thread */ | 326 | /* create new thread */ |
326 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; | 327 | L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; |
@@ -395,6 +396,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
395 | g->allgc = obj2gco(L); /* by now, only object is the main thread */ | 396 | g->allgc = obj2gco(L); /* by now, only object is the main thread */ |
396 | L->next = NULL; | 397 | L->next = NULL; |
397 | g->Cstacklimit = L->nCcalls = LUAI_MAXCSTACK + CSTACKERR; | 398 | g->Cstacklimit = L->nCcalls = LUAI_MAXCSTACK + CSTACKERR; |
399 | incnny(L); /* main thread is always non yieldable */ | ||
398 | g->frealloc = f; | 400 | g->frealloc = f; |
399 | g->ud = ud; | 401 | g->ud = ud; |
400 | g->warnf = NULL; | 402 | g->warnf = NULL; |
@@ -436,8 +438,8 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
436 | 438 | ||
437 | 439 | ||
438 | LUA_API void lua_close (lua_State *L) { | 440 | LUA_API void lua_close (lua_State *L) { |
439 | L = G(L)->mainthread; /* only the main thread can be closed */ | ||
440 | lua_lock(L); | 441 | lua_lock(L); |
442 | L = G(L)->mainthread; /* only the main thread can be closed */ | ||
441 | close_state(L); | 443 | close_state(L); |
442 | } | 444 | } |
443 | 445 | ||