diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-06 17:08:00 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-06 17:08:00 -0200 |
commit | 118347d8c3b83ea0291918e81c5367937316fabb (patch) | |
tree | b77d5b6e03d9ae20841bd80a50cc56237bdf16f5 /lapi.c | |
parent | 6820da509686ce06fdb3de58856056476f55f534 (diff) | |
download | lua-118347d8c3b83ea0291918e81c5367937316fabb.tar.gz lua-118347d8c3b83ea0291918e81c5367937316fabb.tar.bz2 lua-118347d8c3b83ea0291918e81c5367937316fabb.zip |
new API for coroutines
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.214 2002/10/25 20:05:28 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.215 2002/10/25 21:31:28 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -105,6 +105,19 @@ LUA_API int lua_checkstack (lua_State *L, int size) { | |||
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | LUA_API void lua_movethread (lua_State *from, lua_State *to, int n) { | ||
109 | int i; | ||
110 | lua_lock(to); | ||
111 | api_checknelems(from, n); | ||
112 | from->top -= n; | ||
113 | for (i = 0; i < n; i++) { | ||
114 | setobj(to->top, from->top + i); | ||
115 | api_incr_top(to); | ||
116 | } | ||
117 | lua_unlock(to); | ||
118 | } | ||
119 | |||
120 | |||
108 | LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { | 121 | LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { |
109 | lua_CFunction old; | 122 | lua_CFunction old; |
110 | lua_lock(L); | 123 | lua_lock(L); |