diff options
author | Nipun Garg | 2019-06-18 16:12:45 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:47 +0200 |
commit | dafe1b6a16ff9f187e983a4c61b1f23c60ae5cb7 (patch) | |
tree | fd033aa95a37f67ca35924cc3e6528580265e1f1 /engines | |
parent | 5533de992f194fe5559dbd0665939607e2f6e186 (diff) | |
download | scummvm-rg350-dafe1b6a16ff9f187e983a4c61b1f23c60ae5cb7.tar.gz scummvm-rg350-dafe1b6a16ff9f187e983a4c61b1f23c60ae5cb7.tar.bz2 scummvm-rg350-dafe1b6a16ff9f187e983a4c61b1f23c60ae5cb7.zip |
HDB: Add checkParameters() to LuaScript
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; |