saves Lua stack into a record and pops it
| 1200 | |
| 1201 | // saves Lua stack into a record and pops it |
| 1202 | void 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 |
| 1230 | void LuaSaveData::LoadRecord(struct lua_State* L, unsigned int key, unsigned int itemsToLoad) const |
no test coverage detected