diff options
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 19 |
1 files changed, 17 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.17 2004/08/17 17:45:45 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.18 2004/08/30 13:44:44 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 | */ |
| @@ -97,6 +97,7 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { | |||
| 97 | if (from == to) return; | 97 | if (from == to) return; |
| 98 | lua_lock(to); | 98 | lua_lock(to); |
| 99 | api_checknelems(from, n); | 99 | api_checknelems(from, n); |
| 100 | api_check(L, G(from) == G(to)); | ||
| 100 | from->top -= n; | 101 | from->top -= n; |
| 101 | for (i = 0; i < n; i++) { | 102 | for (i = 0; i < n; i++) { |
| 102 | setobj2s(to, to->top, from->top + i); | 103 | setobj2s(to, to->top, from->top + i); |
| @@ -479,6 +480,15 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { | |||
| 479 | } | 480 | } |
| 480 | 481 | ||
| 481 | 482 | ||
| 483 | LUA_API int lua_pushthread (lua_State *L) { | ||
| 484 | lua_lock(L); | ||
| 485 | setthvalue(L, L->top, L); | ||
| 486 | api_incr_top(L); | ||
| 487 | lua_unlock(L); | ||
| 488 | return (G(L)->mainthread == L); | ||
| 489 | } | ||
| 490 | |||
| 491 | |||
| 482 | 492 | ||
| 483 | /* | 493 | /* |
| 484 | ** get functions (Lua -> stack) | 494 | ** get functions (Lua -> stack) |
| @@ -650,7 +660,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
| 650 | case LUA_TTABLE: { | 660 | case LUA_TTABLE: { |
| 651 | hvalue(obj)->metatable = mt; | 661 | hvalue(obj)->metatable = mt; |
| 652 | if (mt) | 662 | if (mt) |
| 653 | luaC_objbarrier(L, hvalue(obj), mt); | 663 | luaC_objbarriert(L, hvalue(obj), mt); |
| 654 | break; | 664 | break; |
| 655 | } | 665 | } |
| 656 | case LUA_TUSERDATA: { | 666 | case LUA_TUSERDATA: { |
| @@ -816,6 +826,11 @@ LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data) { | |||
| 816 | } | 826 | } |
| 817 | 827 | ||
| 818 | 828 | ||
| 829 | LUA_API int lua_threadstatus (lua_State *L) { | ||
| 830 | return L->status; | ||
| 831 | } | ||
| 832 | |||
| 833 | |||
| 819 | /* | 834 | /* |
| 820 | ** Garbage-collection function | 835 | ** Garbage-collection function |
| 821 | */ | 836 | */ |
