summaryrefslogtreecommitdiffstats
path: root/source/LuaState.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-22 20:11:24 +0100
committermadmaxoft <github@xoft.cz>2013-11-22 20:11:24 +0100
commit63753c5e8405837931510b8da648dc75d4970fe1 (patch)
tree58e495519d269f4e6d7aff94294101a5911465cc /source/LuaState.cpp
parentAPIDump: Fixed cRoot's furnace query API. (diff)
downloadcuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar.gz
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar.bz2
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar.lz
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar.xz
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.tar.zst
cuberite-63753c5e8405837931510b8da648dc75d4970fe1.zip
Diffstat (limited to 'source/LuaState.cpp')
-rw-r--r--source/LuaState.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/LuaState.cpp b/source/LuaState.cpp
index ba60ed67d..644f4972c 100644
--- a/source/LuaState.cpp
+++ b/source/LuaState.cpp
@@ -871,6 +871,39 @@ bool cLuaState::CheckParamNumber(int a_StartParam, int a_EndParam)
+bool cLuaState::CheckParamString(int a_StartParam, 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_isstring(m_LuaState, i, 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::CheckParamEnd(int a_Param)
{
tolua_Error tolua_err;