diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-25 09:48:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-25 09:48:16 -0300 |
commit | d766e2ae175495da85714d00e61d76174c5acc5b (patch) | |
tree | afc32a0787e57b2d6807b6e23bdd0a3cedf30945 /ltablib.c | |
parent | f055a9dffd9ba403a99266a662b9992bc89dcaa1 (diff) | |
download | lua-d766e2ae175495da85714d00e61d76174c5acc5b.tar.gz lua-d766e2ae175495da85714d00e61d76174c5acc5b.tar.bz2 lua-d766e2ae175495da85714d00e61d76174c5acc5b.zip |
first (parcial) implementation of 'keyin'/'removekey'
(still no metamethods, no raw verssions)
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.92 2016/02/08 12:55:19 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -113,8 +113,8 @@ static int tremove (lua_State *L) { | |||
113 | lua_geti(L, 1, pos + 1); | 113 | lua_geti(L, 1, pos + 1); |
114 | lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ | 114 | lua_seti(L, 1, pos); /* t[pos] = t[pos + 1] */ |
115 | } | 115 | } |
116 | lua_pushnil(L); | 116 | lua_pushinteger(L, pos); |
117 | lua_seti(L, 1, pos); /* t[pos] = nil */ | 117 | lua_removekey(L, 1); /* remove entry t[pos] */ |
118 | return 1; | 118 | return 1; |
119 | } | 119 | } |
120 | 120 | ||