summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index f5b2cac4a..953b6f17b 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -807,25 +807,6 @@ void cLuaState::Push(UInt32 a_Value)
-void cLuaState::Push(void * a_Ptr)
-{
- UNUSED(a_Ptr);
- ASSERT(IsValid());
-
- // Investigate the cause of this - what is the callstack?
- // One code path leading here is the OnHookExploding / OnHookExploded with exotic parameters. Need to decide what to do with them
- LOGWARNING("Lua engine: attempting to push a plain pointer, pushing nil instead.");
- LOGWARNING("This indicates an unimplemented part of MCS bindings");
- LogStackTrace();
-
- lua_pushnil(m_LuaState);
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
void cLuaState::Push(std::chrono::milliseconds a_Value)
{
ASSERT(IsValid());
@@ -838,20 +819,6 @@ void cLuaState::Push(std::chrono::milliseconds a_Value)
-/*
-void cLuaState::PushUserType(void * a_Object, const char * a_Type)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Object, a_Type);
- m_NumCurrentFunctionArgs += 1;
-}
-*/
-
-
-
-
-
bool cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
{
size_t len = 0;
@@ -1197,6 +1164,39 @@ bool cLuaState::CheckParamNumber(int a_StartParam, int a_EndParam)
+bool cLuaState::CheckParamBool(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_isboolean(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 != nullptr) ? entry.name : "?");
+ tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err);
+ return false;
+ } // for i - Param
+
+ // All params checked ok
+ return true;
+}
+
+
+
+
+
bool cLuaState::CheckParamString(int a_StartParam, int a_EndParam)
{
ASSERT(IsValid());