MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / shallowCopy

Method shallowCopy

source/core/StarLua.cpp:1333–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1331}
1332
1333void LuaDetail::shallowCopy(lua_State* state, int sourceIndex, int targetIndex) {
1334 lua_checkstack(state, 3);
1335
1336 int absSourceIndex = lua_absindex(state, sourceIndex);
1337 int absTargetIndex = lua_absindex(state, targetIndex);
1338
1339 lua_pushnil(state);
1340 while (lua_next(state, absSourceIndex) != 0) {
1341 lua_pushvalue(state, -2);
1342 lua_insert(state, -2);
1343 lua_rawset(state, absTargetIndex);
1344 }
1345}
1346
1347LuaTable LuaDetail::insertJsonMetatable(LuaEngine& engine, LuaTable const& table, Json::Type type) {
1348 auto newIndexMetaMethod = [](LuaTable const& table, LuaValue const& key, LuaValue const& value) {

Callers

nothing calls this directly

Calls 6

lua_checkstackFunction · 0.85
lua_absindexFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawsetFunction · 0.85

Tested by

no test coverage detected