function "move" for tables is better implemented with some "inside
information".
This commit is contained in:
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)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -223,3 +223,13 @@ TObject *luaH_getint (Hash *t, int ref) {
|
|||||||
return luaH_get(t, &index);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
3
ltable.h
3
ltable.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: ltable.h,v 1.6 1998/07/12 16:15:19 roberto Exp roberto $
|
** $Id: ltable.h,v 1.7 1998/12/30 13:14:46 roberto Exp $
|
||||||
** Lua tables (hash)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -22,6 +22,7 @@ TObject *luaH_set (Hash *t, TObject *ref);
|
|||||||
Node *luaH_next (Hash *t, TObject *r);
|
Node *luaH_next (Hash *t, TObject *r);
|
||||||
void luaH_setint (Hash *t, int ref, TObject *val);
|
void luaH_setint (Hash *t, int ref, TObject *val);
|
||||||
TObject *luaH_getint (Hash *t, int ref);
|
TObject *luaH_getint (Hash *t, int ref);
|
||||||
|
void luaH_move (Hash *t, int from, int to);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user