summaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_entity.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-08-05 00:49:35 -0400
committerkwolekr <kwolekr@minetest.net>2015-08-05 21:13:03 -0400
commitbcf47bc67cf3e1c2f410a81e26ceab1bdab06b4a (patch)
tree11bd99b70ceb33175d7883cea4ab287cc5b09175 /src/script/cpp_api/s_entity.cpp
parent3183d5a4038f16b5b4cbcfd0dac5f8d458bf8ba2 (diff)
downloadminetest-bcf47bc67cf3e1c2f410a81e26ceab1bdab06b4a.tar.gz
minetest-bcf47bc67cf3e1c2f410a81e26ceab1bdab06b4a.tar.bz2
minetest-bcf47bc67cf3e1c2f410a81e26ceab1bdab06b4a.zip
Improve Script CPP API diagnostics
Diffstat (limited to 'src/script/cpp_api/s_entity.cpp')
-rw-r--r--src/script/cpp_api/s_entity.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/script/cpp_api/s_entity.cpp b/src/script/cpp_api/s_entity.cpp
index b52bde18a..08e06ccbc 100644
--- a/src/script/cpp_api/s_entity.cpp
+++ b/src/script/cpp_api/s_entity.cpp
@@ -92,8 +92,7 @@ void ScriptApiEntity::luaentity_Activate(u16 id,
lua_pushlstring(L, staticdata.c_str(), staticdata.size());
lua_pushinteger(L, dtime_s);
// Call with 3 arguments, 0 results
- if (lua_pcall(L, 3, 0, m_errorhandler))
- scriptError();
+ PCALL_RES(lua_pcall(L, 3, 0, m_errorhandler));
} else {
lua_pop(L, 1);
}
@@ -140,8 +139,7 @@ std::string ScriptApiEntity::luaentity_GetStaticdata(u16 id)
luaL_checktype(L, -1, LUA_TFUNCTION);
lua_pushvalue(L, object); // self
// Call with 1 arguments, 1 results
- if (lua_pcall(L, 1, 1, m_errorhandler))
- scriptError();
+ PCALL_RES(lua_pcall(L, 1, 1, m_errorhandler));
lua_remove(L, object); // Remove object
size_t len = 0;
@@ -210,8 +208,7 @@ void ScriptApiEntity::luaentity_Step(u16 id, float dtime)
lua_pushvalue(L, object); // self
lua_pushnumber(L, dtime); // dtime
// Call with 2 arguments, 0 results
- if (lua_pcall(L, 2, 0, m_errorhandler))
- scriptError();
+ PCALL_RES(lua_pcall(L, 2, 0, m_errorhandler));
lua_pop(L, 1); // Pop object
}
@@ -242,8 +239,7 @@ void ScriptApiEntity::luaentity_Punch(u16 id,
push_tool_capabilities(L, *toolcap);
push_v3f(L, dir);
// Call with 5 arguments, 0 results
- if (lua_pcall(L, 5, 0, m_errorhandler))
- scriptError();
+ PCALL_RES(lua_pcall(L, 5, 0, m_errorhandler));
lua_pop(L, 1); // Pop object
}
@@ -269,8 +265,7 @@ void ScriptApiEntity::luaentity_Rightclick(u16 id,
lua_pushvalue(L, object); // self
objectrefGetOrCreate(L, clicker); // Clicker reference
// Call with 2 arguments, 0 results
- if (lua_pcall(L, 2, 0, m_errorhandler))
- scriptError();
+ PCALL_RES(lua_pcall(L, 2, 0, m_errorhandler));
lua_pop(L, 1); // Pop object
}