From 7316d61a66a3dda73009d9bcf9b1bc63351b3563 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 25 Feb 2008 11:33:57 -0300 Subject: 'coroutine.running' should work for the main thread too --- lbaselib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index a2d9cbb9..44329856 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.204 2008/02/14 16:03:09 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.205 2008/02/19 18:54:09 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -583,9 +583,9 @@ static int luaB_costatus (lua_State *L) { static int luaB_corunning (lua_State *L) { - if (lua_pushthread(L)) - lua_pushnil(L); /* main thread is not a coroutine */ - return 1; + int ismain = lua_pushthread(L); + lua_pushboolean(L, ismain); + return 2; } -- cgit v1.2.3-55-g6feb