Result Class Reference

#include <Pt/Lua/Result.h>

Result of a finished Lua script. More...

Public Member Functions

 Result ()
 Creates a result with no Lua state.
 Result (lua_State *L)
 Creates a result that reads globals from L.
int get (const std::string &name) const
 Returns the integer value of the global name.

Detailed Description

After a Script has reached ScriptOk, Result reads a named Lua global as an int from that context's state. Construct it with Context::state() and call get() with the global name the script assigned. A missing or non-numeric global converts as Lua does for integers, typically to zero.

The result does not own the state. The context that produced the state must outlive the result.