MCPcopy Create free account
hub / github.com/TASEmulators/fceux / SaveRecord

Method SaveRecord

src/lua-engine.cpp:1202–1227  ·  view source on GitHub ↗

saves Lua stack into a record and pops it

Source from the content-addressed store, hash-verified

1200
1201// saves Lua stack into a record and pops it
1202void LuaSaveData::SaveRecord(lua_State* L, unsigned int key)
1203{
1204 if(!L)
1205 return;
1206
1207 Record* cur = new Record();
1208 cur->key = key;
1209 cur->data = LuaStackToBinary(L, cur->size);
1210 cur->next = NULL;
1211
1212 lua_settop(L,0);
1213
1214 if(cur->size <= 0)
1215 {
1216 delete cur;
1217 return;
1218 }
1219
1220 Record* last = recordList;
1221 while(last && last->next)
1222 last = last->next;
1223 if(last)
1224 last->next = cur;
1225 else
1226 recordList = cur;
1227}
1228
1229// pushes a record's data onto the Lua stack
1230void LuaSaveData::LoadRecord(struct lua_State* L, unsigned int key, unsigned int itemsToLoad) const

Callers 1

Calls 2

LuaStackToBinaryFunction · 0.85
lua_settopFunction · 0.85

Tested by

no test coverage detected