From b9c9ccfbb4ed9c6cf6177d20cfd376a0fcb7a959 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 4 Jan 1999 10:54:33 -0200 Subject: function "move" for tables is better implemented with some "inside information". --- ltable.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ltable.c') diff --git a/ltable.c b/ltable.c index 35a7eec8..c875d189 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 1.15 1998/08/11 16:38:34 roberto Exp roberto $ +** $Id: ltable.c,v 1.16 1998/12/30 13:14:46 roberto Exp $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -223,3 +223,13 @@ TObject *luaH_getint (Hash *t, int ref) { return luaH_get(t, &index); } + +void luaH_move (Hash *t, int from, int to) { + TObject index; + TObject *toadd; + ttype(&index) = LUA_T_NUMBER; + nvalue(&index) = to; + toadd = luaH_set(t, &index); + nvalue(&index) = from; + *toadd = *luaH_get(t, &index); +} -- cgit v1.2.3-55-g6feb