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

Function LuaStackToBinary

src/lua-engine.cpp:1167–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165static const unsigned char luaBinaryMinorVersion = 1;
1166
1167unsigned char* LuaStackToBinary(lua_State* L, unsigned int& size)
1168{
1169 int n = lua_gettop(L);
1170 if(n == 0)
1171 return NULL;
1172
1173 std::vector<unsigned char> output;
1174 output.push_back(luaBinaryMajorVersion);
1175 output.push_back(luaBinaryMinorVersion);
1176
1177 for(int i = 1; i <= n; i++)
1178 LuaStackToBinaryConverter(L, i, output);
1179
1180 unsigned char* rv = new unsigned char [output.size()];
1181 memcpy(rv, &output.front(), output.size());
1182 size = output.size();
1183 return rv;
1184}
1185
1186void BinaryToLuaStack(lua_State* L, const unsigned char* data, unsigned int size, unsigned int itemsToLoad)
1187{

Callers 1

SaveRecordMethod · 0.85

Calls 3

lua_gettopFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected