Files
integration/luprex/core/cpp/luasnap.hpp

43 lines
963 B
C++
Raw Normal View History

2021-02-16 13:31:34 -05:00
/////////////////////////////////////////////////////////////////////////////
2021-02-09 17:15:54 -05:00
//
// LUASNAP
//
2021-02-16 13:31:34 -05:00
// A lua interpreter that can be checkpointed (snapshotted). This makes it
// possible to roll the entire interpreter back to a previously-snapshotted
// state.
2021-02-09 17:15:54 -05:00
//
// To accomplish this, we use eris serialization. This is messy and not
// very modular, but it does work.
2021-02-09 17:15:54 -05:00
//
2021-02-16 13:31:34 -05:00
/////////////////////////////////////////////////////////////////////////////
2021-02-09 17:15:54 -05:00
#ifndef LUASNAP_HPP
#define LUASNAP_HPP
#include "streambuffer.hpp"
2021-02-09 17:15:54 -05:00
#include "luastack.hpp"
class LuaSnap {
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);
2021-02-09 17:15:54 -05:00
};
#endif // LUASNAP_HPP