diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/lua-script.cpp | 10 | ||||
-rw-r--r-- | engines/hdb/lua-script.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 8a79bdd1ed..87a72d5eb9 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -851,4 +851,14 @@ void LuaScript::addPatches(Common::String &chunk, const char* scriptName) { patch++; } } + +void LuaScript::checkParameters(char *func, int params) { + int stackTop = lua_gettop(_state); + if (stackTop < params) { + warning("%s: Not Enough Parameters", func); + } else if (stackTop > params) { + warning("%s: Too Many Parameters", func); + } +} + } diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h index ea209a383c..81d9980713 100644 --- a/engines/hdb/lua-script.h +++ b/engines/hdb/lua-script.h @@ -42,6 +42,7 @@ public: bool callFunction(const char *name, int returns); bool executeMPC(Common::SeekableReadStream *stream, const char *name, const char *scriptName, int32 length); bool executeFile(const Common::String &filename); + void checkParameters(char *func, int params); private: lua_State *_state; |