diff options
| author | Mike Pall <mike> | 2011-02-20 20:33:00 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-02-20 20:33:00 +0100 |
| commit | d82022a6568447ca261e3635186f332fa9f3614d (patch) | |
| tree | d10edd0615a94508925d74cf874c68fb2beeab90 /src | |
| parent | 34bcf6378b7f4100353fe0f82d669432761a533c (diff) | |
| download | luajit-d82022a6568447ca261e3635186f332fa9f3614d.tar.gz luajit-d82022a6568447ca261e3635186f332fa9f3614d.tar.bz2 luajit-d82022a6568447ca261e3635186f332fa9f3614d.zip | |
From Lua 5.2: coroutine.running(). Needs -DLUAJIT_ENABLE_LUA52COMPAT.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib_base.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 746a4fd6..bac49a0b 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | ** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h | 3 | ** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h |
| 4 | ** | 4 | ** |
| 5 | ** Major portions taken verbatim or adapted from the Lua interpreter. | 5 | ** Major portions taken verbatim or adapted from the Lua interpreter. |
| 6 | ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h | 6 | ** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| @@ -522,9 +522,15 @@ LJLIB_CF(coroutine_status) | |||
| 522 | 522 | ||
| 523 | LJLIB_CF(coroutine_running) | 523 | LJLIB_CF(coroutine_running) |
| 524 | { | 524 | { |
| 525 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | ||
| 526 | int ismain = lua_pushthread(L); | ||
| 527 | setboolV(L->top++, ismain); | ||
| 528 | return 2; | ||
| 529 | #else | ||
| 525 | if (lua_pushthread(L)) | 530 | if (lua_pushthread(L)) |
| 526 | setnilV(L->top++); | 531 | setnilV(L->top++); |
| 527 | return 1; | 532 | return 1; |
| 533 | #endif | ||
| 528 | } | 534 | } |
| 529 | 535 | ||
| 530 | LJLIB_CF(coroutine_create) | 536 | LJLIB_CF(coroutine_create) |
