summaryrefslogtreecommitdiffstats
path: root/source/LuaState.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-22 16:49:38 +0100
committermadmaxoft <github@xoft.cz>2013-11-22 16:49:38 +0100
commit14569885e55c7f3def2b0f56765c742a162c0fe1 (patch)
tree6eb9f2570ec02229d4db5bb8c7dc74143ccc6afb /source/LuaState.cpp
parentAPIDump: Documented new cRoot:GetFurnaceRecipe(). (diff)
downloadcuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar.gz
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar.bz2
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar.lz
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar.xz
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.tar.zst
cuberite-14569885e55c7f3def2b0f56765c742a162c0fe1.zip
Diffstat (limited to '')
-rw-r--r--source/LuaState.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/LuaState.cpp b/source/LuaState.cpp
index 8d2fa8eca..ba60ed67d 100644
--- a/source/LuaState.cpp
+++ b/source/LuaState.cpp
@@ -739,6 +739,39 @@ bool cLuaState::CallFunction(int a_NumResults)
+bool cLuaState::CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam)
+{
+ ASSERT(IsValid());
+
+ if (a_EndParam < 0)
+ {
+ a_EndParam = a_StartParam;
+ }
+
+ tolua_Error tolua_err;
+ for (int i = a_StartParam; i <= a_EndParam; i++)
+ {
+ if (tolua_isusertable(m_LuaState, i, a_UserTable, 0, &tolua_err))
+ {
+ continue;
+ }
+ // Not the correct parameter
+ lua_Debug entry;
+ VERIFY(lua_getstack(m_LuaState, 0, &entry));
+ VERIFY(lua_getinfo (m_LuaState, "n", &entry));
+ AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?");
+ tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
+ return false;
+ } // for i - Param
+
+ // All params checked ok
+ return true;
+}
+
+
+
+
+
bool cLuaState::CheckParamUserType(int a_StartParam, const char * a_UserType, int a_EndParam)
{
ASSERT(IsValid());