Script Class Reference

#include <Pt/Lua/Script.h>

Lua script.

Inherits Selectable, and Connectable.

Public Member Functions

AsyncAdvance advanceAsync ()
 Asynchronously advance the Lua script as a C++20 awaitable. More...
 
void setActive (EventLoop &parent)
 Sets the parent loop, so that operations can be run.
 
void detach ()
 Remove from event loop and cancels outstanding operations.
 
void cancel ()
 Cancels all operations.
 
bool run ()
 Run operation if it is ready.
 
EventLoop * parent () const
 Returns the used event loop.
 

Protected Member Functions

bool onRun ()
 Check if ready and run.
 
void onAttach (Pt::System::EventLoop &loop)
 Attached to loop.
 
void onDetach (Pt::System::EventLoop &loop)
 Detached from loop.
 
void onCancel ()
 Blocks until operation has cancelled.
 
void post ()
 Posts this selectable to its event loop from any thread.
 

Member Function Documentation

◆ advanceAsync()

AsyncAdvance advanceAsync ( )

Returns an awaitable for use with co_await. Wraps beginAdvance() / endAdvance() / advanced().