[slot] bool QtLuaEngine::eval(QByteArray s, bool async = false)
[slot] bool QtLuaEngine::eval(QString s, bool async = false)
Function eval
runs the Lua code contained in string s
.
When function eval
is invoked from the thread owning
the Lua engine object, the Lua code is executed right away.
Otherwise the execution of the Lua code is started
in the thread owning the Lua engine object using
thread hopping. Function eval
returns immediately if flag async
is true
.
Otherwise it processes Qt events and waits
until the termination of the Lua code.
This function returns true
if the evaluation
was performed without error. It immediately
returns false
if the Lua engine was not
in state ready
or if flag async
was true
when calling the function from the engine thread.
[slot] QVariantList QtLuaEngine::evaluate(QByteArray s)
[slot] QVariantList QtLuaEngine::evaluate(QString s)
Function evaluate
returns an empty QVariantList
if
called when the engine is not in ready state.
Otherwise if evaluates Lua code s
like function eval
.
If an error occurs during evaluation,
function evaluate
returns a list
whose first element is QVariant(false)
and whose
second element is the error message.
Otherwise is returns a list whose first element is
QVariant(true)
and whose remaining elements
are the evaluation results.
[slot] bool QtLuaEngine::stop(bool nopause = false)
When the Lua engine is in state Running
,
function stop
interrupts the execution
of Lua code and returns true
.
If the Lua engine is not in state Running
,
this function does nothing and simply returns false
.
If the property pauseOnError
is true
and flag nopause
is false,
the Lua engine enters the state Paused
when it stops.
Otherwise it unwinds the stack as if an error had occurred
and returns to state Ready
.
[slot] bool QtLuaEngine::resume(bool nocontinue=false)
This function does nothing and returns false
unless the Lua engine is in state Paused
.
If the Lua engine entered state Paused
because function stop
was called,
and if argument nocontinue
is false
, the Lua interpreter
returns to state Running
and resumes the execution of the Lua
code interrupted by function stop
.
Otherwise the interpreter unwinds the stack, reports the error,
and returns to state Ready
.