aboutsummaryrefslogtreecommitdiff
path: root/lcorolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-04-27 15:59:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2012-04-27 15:59:04 -0300
commitbb1146dc3986c6f123ed6d85a26694ca8d56f94a (patch)
tree0d168290c4fcc2086c6ec252805720d16dedfba8 /lcorolib.c
parentfc24a3a6c40b573f1a89cf89b92d16a25519cc36 (diff)
downloadlua-bb1146dc3986c6f123ed6d85a26694ca8d56f94a.tar.gz
lua-bb1146dc3986c6f123ed6d85a26694ca8d56f94a.tar.bz2
lua-bb1146dc3986c6f123ed6d85a26694ca8d56f94a.zip
wrong error message when 'coroutine.create' or 'coroutine.wrap' are
called with no arguments (new thread is assumed to be the missing argument).
Diffstat (limited to 'lcorolib.c')
-rw-r--r--lcorolib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lcorolib.c b/lcorolib.c
index 78eb9e98..d5552047 100644
--- a/lcorolib.c
+++ b/lcorolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcorolib.c,v 1.2 2010/07/02 11:38:13 roberto Exp roberto $ 2** $Id: lcorolib.c,v 1.3 2011/08/23 17:24:34 roberto Exp roberto $
3** Coroutine Library 3** Coroutine Library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -80,8 +80,9 @@ static int luaB_auxwrap (lua_State *L) {
80 80
81 81
82static int luaB_cocreate (lua_State *L) { 82static int luaB_cocreate (lua_State *L) {
83 lua_State *NL = lua_newthread(L); 83 lua_State *NL;
84 luaL_checktype(L, 1, LUA_TFUNCTION); 84 luaL_checktype(L, 1, LUA_TFUNCTION);
85 NL = lua_newthread(L);
85 lua_pushvalue(L, 1); /* move function to top */ 86 lua_pushvalue(L, 1); /* move function to top */
86 lua_xmove(L, NL, 1); /* move function from L to NL */ 87 lua_xmove(L, NL, 1); /* move function from L to NL */
87 return 1; 88 return 1;