MCPcopy Create free account
hub / github.com/DFHack/dfhack / copy_table

Function copy_table

library/LuaWrapper.cpp:790–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790static void copy_table(lua_State *state, int dest, int src, int skipbase)
791{
792 // stack: (skipbase) skipkey skipkey |
793
794 int top = lua_gettop(state);
795
796 lua_pushnil(state);
797
798 while (lua_next(state, src))
799 {
800 for (int i = skipbase+1; i <= top; i++)
801 {
802 if (lua_rawequal(state, -2, i))
803 {
804 lua_pop(state, 1);
805 goto next_outer;
806 }
807 }
808
809 {
810 lua_pushvalue(state, -2);
811 lua_swap(state);
812 lua_settable(state, dest);
813 }
814
815 next_outer:;
816 }
817}
818
819/**
820 * Method: assign data between objects.

Callers 1

meta_assignFunction · 0.85

Calls 7

lua_gettopFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_rawequalFunction · 0.85
lua_pushvalueFunction · 0.85
lua_swapFunction · 0.85
lua_settableFunction · 0.85

Tested by

no test coverage detected