30 #ifndef PT_LUA_SCRIPT_H
31 #define PT_LUA_SCRIPT_H
33 #include <Pt/Lua/Api.h>
34 #include <Pt/System/Selectable.h>
35 #include <Pt/Signal.h>
42 #if __cplusplus >= 202002L
44 #include <Pt/Coroutine.h>
51 namespace Reflex {
class Type; }
59 #if __cplusplus >= 202002L
85 Status endAdvance()
const;
91 const std::string& errorMessage()
const
94 static Script* fromState(lua_State* L);
96 #if __cplusplus >= 202002L
118 #if __cplusplus >= 202002L
130 void onAsyncCallFinished();
132 bool onAsyncCallReady();
134 int pushResult(
Pt::Any& value, Pt::Reflex::Type& type);
138 bool isCancelled()
const;
140 void setError(
const std::string& msg);
142 static void yieldHook(lua_State* L, lua_Debug* ar);
149 std::string _errorMsg;
153 AsyncCall* _pendingAsyncCall;
154 AsyncCall* _activeAsyncCall;
156 #if __cplusplus >= 202002L
161 #if __cplusplus >= 202002L
178 Script::Status await_resume();
183 void onBegin()
override;
185 void onCancel()
override;
197 #endif // __cplusplus >= 202002L
203 #endif // include guard
Core module.
Definition: Allocator.h:33
Multicast Signal to call multiple slots.
Definition: Signal.h:190
Scripting context.
Definition: Context.h:51
AsyncAdvance advanceAsync()
Asynchronously advance the Lua script as a C++20 awaitable.
void onCancel()
Blocks until operation has cancelled.
bool onRun()
Check if ready and run.
Awaitable for async advance of a Lua Script.
Definition: Script.h:172
Connection Management for Signal and Slot Objects.
Definition: Connectable.h:50
void onAttach(Pt::System::EventLoop &loop)
Attached to loop.
Dispatches operations through an event loop.
Definition: Selectable.h:45
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:83
Contains an arbitrary type.
Definition: Any.h:64
void onDetach(Pt::System::EventLoop &loop)
Detached from loop.
Lua script.
Definition: Script.h:69
Provides the base class for I/O-driven co_await-able operations.
Definition: Coroutine.h:126