diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.217 2002/11/07 15:37:10 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.218 2002/11/07 15:39:23 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 | */ |
@@ -505,20 +505,6 @@ LUA_API void lua_newtable (lua_State *L) { | |||
505 | } | 505 | } |
506 | 506 | ||
507 | 507 | ||
508 | LUA_API const char *lua_getmode (lua_State *L, int index) { | ||
509 | static const char *const modes[] = {"", "k", "v", "kv"}; | ||
510 | int mode = 0; | ||
511 | TObject *t; | ||
512 | lua_lock(L); | ||
513 | t = luaA_index(L, index); | ||
514 | api_check(L, ttistable(t)); | ||
515 | if (hvalue(t)->mode & WEAKKEY) mode += 1; | ||
516 | if (hvalue(t)->mode & WEAKVALUE) mode += 2; | ||
517 | lua_unlock(L); | ||
518 | return modes[mode]; | ||
519 | } | ||
520 | |||
521 | |||
522 | LUA_API int lua_getmetatable (lua_State *L, int objindex) { | 508 | LUA_API int lua_getmetatable (lua_State *L, int objindex) { |
523 | StkId obj; | 509 | StkId obj; |
524 | Table *mt; | 510 | Table *mt; |
@@ -597,17 +583,6 @@ LUA_API void lua_rawseti (lua_State *L, int index, int n) { | |||
597 | } | 583 | } |
598 | 584 | ||
599 | 585 | ||
600 | LUA_API void lua_setmode (lua_State *L, int index, const char *mode) { | ||
601 | TObject *t; | ||
602 | lua_lock(L); | ||
603 | t = luaA_index(L, index); | ||
604 | api_check(L, ttistable(t)); | ||
605 | hvalue(t)->mode &= ~(WEAKKEY | WEAKVALUE); /* clear bits */ | ||
606 | if (strchr(mode, 'k')) hvalue(t)->mode |= WEAKKEY; | ||
607 | if (strchr(mode, 'v')) hvalue(t)->mode |= WEAKVALUE; | ||
608 | lua_unlock(L); | ||
609 | } | ||
610 | |||
611 | LUA_API int lua_setmetatable (lua_State *L, int objindex) { | 586 | LUA_API int lua_setmetatable (lua_State *L, int objindex) { |
612 | TObject *obj, *mt; | 587 | TObject *obj, *mt; |
613 | int res = 1; | 588 | int res = 1; |