///////////////////////////////////////////////////////////////////////////// // // 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 "luastack.hpp" class LuaSnap { private: lua_State *state_; std::string snapshot_; public: LuaSnap(); ~LuaSnap(); // Get the lua intepreter. // lua_State *state() const { return state_; } // Return true if there's a saved snapshot. // bool have_snapshot() const; // snapshot the state of the lua interpreter. // // If there is already a snapshot, this panics. // void snapshot(); // Rollback the lua intepreter to the snapshotted state. // // If there is no snapshot, this panics. // void rollback(); }; #endif // LUASNAP_HPP