diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-04-04 11:23:41 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-04-04 11:23:41 -0300 |
| commit | 03c6a05ec836c3a90a6b8d730120afdad39c092b (patch) | |
| tree | 31f0bdf82969b1e082e92d7b5dd5d9e1496d64af /lapi.c | |
| parent | 3d0b5edfe4df7ec54d6885b6b6ce917faddf6661 (diff) | |
| download | lua-03c6a05ec836c3a90a6b8d730120afdad39c092b.tar.gz lua-03c6a05ec836c3a90a6b8d730120afdad39c092b.tar.bz2 lua-03c6a05ec836c3a90a6b8d730120afdad39c092b.zip | |
no more nil-in-table
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 23 |
1 files changed, 1 insertions, 22 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.289 2018/02/27 17:48:28 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.290 2018/02/27 20:01:55 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 | */ |
| @@ -705,27 +705,6 @@ LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { | |||
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | 707 | ||
| 708 | static int auxkeydef (lua_State *L, int idx, int remove) { | ||
| 709 | int res; | ||
| 710 | lua_lock(L); | ||
| 711 | api_checknelems(L, 1); | ||
| 712 | res = luaT_keydef(L, index2value(L, idx), s2v(L->top - 1), remove); | ||
| 713 | L->top--; /* remove key */ | ||
| 714 | lua_unlock(L); | ||
| 715 | return res; | ||
| 716 | } | ||
| 717 | |||
| 718 | |||
| 719 | LUA_API void lua_removekey (lua_State *L, int idx) { | ||
| 720 | auxkeydef(L, idx, 1); | ||
| 721 | } | ||
| 722 | |||
| 723 | |||
| 724 | LUA_API int lua_keyin (lua_State *L, int idx) { | ||
| 725 | return auxkeydef(L, idx, 0); | ||
| 726 | } | ||
| 727 | |||
| 728 | |||
| 729 | LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { | 708 | LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { |
| 730 | Table *t; | 709 | Table *t; |
| 731 | lua_lock(L); | 710 | lua_lock(L); |
