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/lcorolib.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/lcorolib.c')
| -rw-r--r-- | src/lua/lcorolib.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lua/lcorolib.c b/src/lua/lcorolib.c index 7d6e585..c165031 100644 --- a/src/lua/lcorolib.c +++ b/src/lua/lcorolib.c | |||
| @@ -73,11 +73,12 @@ static int luaB_coresume (lua_State *L) { | |||
| 73 | static int luaB_auxwrap (lua_State *L) { | 73 | static int luaB_auxwrap (lua_State *L) { |
| 74 | lua_State *co = lua_tothread(L, lua_upvalueindex(1)); | 74 | lua_State *co = lua_tothread(L, lua_upvalueindex(1)); |
| 75 | int r = auxresume(L, co, lua_gettop(L)); | 75 | int r = auxresume(L, co, lua_gettop(L)); |
| 76 | if (r < 0) { | 76 | if (r < 0) { /* error? */ |
| 77 | int stat = lua_status(co); | 77 | int stat = lua_status(co); |
| 78 | if (stat != LUA_OK && stat != LUA_YIELD) | 78 | if (stat != LUA_OK && stat != LUA_YIELD) /* error in the coroutine? */ |
| 79 | lua_resetthread(co); /* close variables in case of errors */ | 79 | lua_resetthread(co); /* close its tbc variables */ |
| 80 | if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ | 80 | if (stat != LUA_ERRMEM && /* not a memory error and ... */ |
| 81 | lua_type(L, -1) == LUA_TSTRING) { /* ... error object is a string? */ | ||
| 81 | luaL_where(L, 1); /* add extra info, if available */ | 82 | luaL_where(L, 1); /* add extra info, if available */ |
| 82 | lua_insert(L, -2); | 83 | lua_insert(L, -2); |
| 83 | lua_concat(L, 2); | 84 | lua_concat(L, 2); |
