Files
integration/luprex/core/cpp/luasnap.hpp
2022-03-02 14:52:51 -05:00

43 lines
986 B
C++

/////////////////////////////////////////////////////////////////////////////
//
// LUASNAP
//
// A lua interpreter that can be checkpointed (snapshotted). This makes it
// possible to roll the entire interpreter back to a previously-snapshotted
// state.
//
// To accomplish this, we use eris serialization. This is messy and not
// very modular, but it does work.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef LUASNAP_HPP
#define LUASNAP_HPP
#include "streambuffer.hpp"
#include "luastack.hpp"
class LuaSnap : public eng::nevernew {
private:
lua_State *state_;
public:
LuaSnap();
~LuaSnap();
// Get the lua intepreter.
//
lua_State *state() const { return state_; }
// Serialize the state of the lua interpreter.
//
void serialize(StreamBuffer *sb);
// Restore the the lua interpreter given a serialized state.
//
void deserialize(StreamBuffer *sb);
};
#endif // LUASNAP_HPP