diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-09 19:50:35 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-09 19:50:35 -0200 |
commit | b3bb0f132b2a3dba88385f8d71ba3f34252d94e4 (patch) | |
tree | 111d09e92f36a4525ee9a62596925ac6cc9567b0 /lapi.c | |
parent | facfec0687ff20351d3c7520344a722b9149c9ea (diff) | |
download | lua-b3bb0f132b2a3dba88385f8d71ba3f34252d94e4.tar.gz lua-b3bb0f132b2a3dba88385f8d71ba3f34252d94e4.tar.bz2 lua-b3bb0f132b2a3dba88385f8d71ba3f34252d94e4.zip |
new interface for weak modes
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 24 |
1 files changed, 2 insertions, 22 deletions
@@ -695,28 +695,7 @@ LUA_API void lua_newuserdatabox (lua_State *L, void *p) { | |||
695 | } | 695 | } |
696 | 696 | ||
697 | 697 | ||
698 | LUA_API int lua_getweakmode (lua_State *L, int index) { | 698 | LUA_API int lua_pushupvalues (lua_State *L) { |
699 | StkId t; | ||
700 | int mode; | ||
701 | lua_lock(L); | ||
702 | t = luaA_index(L, index); | ||
703 | api_check(L, ttype(t) == LUA_TTABLE); | ||
704 | mode = hvalue(t)->weakmode; | ||
705 | lua_unlock(L); | ||
706 | return mode; | ||
707 | } | ||
708 | |||
709 | |||
710 | LUA_API void lua_setweakmode (lua_State *L, int mode) { | ||
711 | lua_lock(L); | ||
712 | api_check(L, ttype(L->top-1) == LUA_TTABLE); | ||
713 | hvalue(L->top-1)->weakmode = cast(lu_byte, mode); | ||
714 | lua_unlock(L); | ||
715 | } | ||
716 | |||
717 | |||
718 | |||
719 | LUA_API void lua_pushupvalues (lua_State *L) { | ||
720 | TObject *func; | 699 | TObject *func; |
721 | int n, i; | 700 | int n, i; |
722 | lua_lock(L); | 701 | lua_lock(L); |
@@ -730,6 +709,7 @@ LUA_API void lua_pushupvalues (lua_State *L) { | |||
730 | L->top++; | 709 | L->top++; |
731 | } | 710 | } |
732 | lua_unlock(L); | 711 | lua_unlock(L); |
712 | return n; | ||
733 | } | 713 | } |
734 | 714 | ||
735 | 715 | ||