mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
function "move" for tables is better implemented with some "inside
information".
This commit is contained in:
parent
b94110a68f
commit
b9c9ccfbb4
2 changed files with 13 additions and 2 deletions
12
ltable.c
12
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue