diff --git a/src/app/script/app_object.cpp b/src/app/script/app_object.cpp index ca59c5414..360cff4d8 100644 --- a/src/app/script/app_object.cpp +++ b/src/app/script/app_object.cpp @@ -63,7 +63,8 @@ void App_transaction(script::ContextHandle handle) if (ctx.isCallable(1)) { Tx tx; // Create a new transaction so it exists in the whole // duration of the argument function call. - ctx.call(1); + ctx.copy(1); + ctx.call(0); tx.commit(); } else diff --git a/src/script/engine.cpp b/src/script/engine.cpp index 89284729b..73e6dc957 100644 --- a/src/script/engine.cpp +++ b/src/script/engine.cpp @@ -45,11 +45,6 @@ void* Context::getContextUserData() return js_getcontext(m_handle); } -void Context::call(index_t i) -{ - js_call(m_handle, i); -} - void Context::error(const char* err) { js_error(m_handle, "%s", err); @@ -80,6 +75,16 @@ index_t Context::top() return js_gettop(m_handle); } +void Context::copy(index_t i) +{ + js_copy(m_handle, i); +} + +void Context::call(index_t args) +{ + js_call(m_handle, args); +} + bool Context::isUndefined(index_t i) { return (js_isundefined(m_handle, i) ? true: false); diff --git a/src/script/engine.h b/src/script/engine.h index 06f49e882..dc96f6851 100644 --- a/src/script/engine.h +++ b/src/script/engine.h @@ -55,7 +55,6 @@ namespace script { void setContextUserData(void* userData); void* getContextUserData(); - void call(index_t i); void error(const char* err); void pop(); @@ -63,6 +62,8 @@ namespace script { void remove(index_t idx); void duplicateTop(); index_t top(); + void copy(index_t i); + void call(index_t args); bool isUndefined(index_t i); bool isNull(index_t i);