lua

A copy of the Lua development repository
Log | Files | Refs | README

commit bb1146dc3986c6f123ed6d85a26694ca8d56f94a
parent fc24a3a6c40b573f1a89cf89b92d16a25519cc36
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 27 Apr 2012 15:58:40 -0300

wrong error message when 'coroutine.create' or 'coroutine.wrap' are
called with no arguments (new thread is assumed to be the missing
argument).

Diffstat:
Mlcorolib.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lcorolib.c b/lcorolib.c @@ -1,5 +1,5 @@ /* -** $Id: lcorolib.c,v 1.2 2010/07/02 11:38:13 roberto Exp roberto $ +** $Id: lcorolib.c,v 1.3 2011/08/23 17:24:34 roberto Exp roberto $ ** Coroutine Library ** See Copyright Notice in lua.h */ @@ -80,8 +80,9 @@ static int luaB_auxwrap (lua_State *L) { static int luaB_cocreate (lua_State *L) { - lua_State *NL = lua_newthread(L); + lua_State *NL; luaL_checktype(L, 1, LUA_TFUNCTION); + NL = lua_newthread(L); lua_pushvalue(L, 1); /* move function to top */ lua_xmove(L, NL, 1); /* move function from L to NL */ return 1;