#pragma once #include "boost/function.hpp" #include "reflection/Type.h" struct lua_State; namespace RBX { class BaseScript; namespace Scripts { typedef boost::function results)> SuccessHandler; typedef boost::function source, int line)> ErrorHandler; struct Continuations { SuccessHandler successHandler; ErrorHandler errorHandler; bool empty() const { return successHandler.empty() && errorHandler.empty(); } }; } namespace Lua { class Continuations { public: Continuations(const Scripts::Continuations& eh); Continuations() {} boost::function success; // called when the thread exits via ScriptContext::resume boost::function error; // called when the thread errors via ScriptContext::resume private: static void onSuccessHandler(lua_State* thread, Scripts::SuccessHandler handler); static void onErrorHandler(lua_State* thread, Scripts::ErrorHandler handler); }; } }