aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-27 07:10:08 +0530
committerEugene Sandulenko2019-09-03 17:17:01 +0200
commit368e80c75f157da79747d2166502d97215b7b5bc (patch)
treea93c6a73aa9a268e970785aa076653cddb5f0c09
parentfbeb7f8c4ef472a4532926ab367e5dd5606067d9 (diff)
downloadscummvm-rg350-368e80c75f157da79747d2166502d97215b7b5bc.tar.gz
scummvm-rg350-368e80c75f157da79747d2166502d97215b7b5bc.tar.bz2
scummvm-rg350-368e80c75f157da79747d2166502d97215b7b5bc.zip
HDB: Add lua_push functions and call()
-rw-r--r--engines/hdb/lua-script.cpp28
-rw-r--r--engines/hdb/lua-script.h6
2 files changed, 33 insertions, 1 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index cbed8b5259..188ab2b308 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -814,7 +814,6 @@ void debugHook(lua_State *L, lua_Debug *ar) {
}
}
-
bool LuaScript::initScript(Common::SeekableReadStream *stream, const char *scriptName, int32 length) {
if (_systemInit) {
@@ -940,6 +939,33 @@ bool LuaScript::initScript(Common::SeekableReadStream *stream, const char *scrip
return true;
}
+void LuaScript::pushInt(int value) {
+ if (!_systemInit)
+ return;
+ lua_pushnumber(_state, (double)value);
+}
+
+void LuaScript::pushString(char *string) {
+ if (!_systemInit)
+ return;
+ lua_pushstring(_state, string);
+}
+
+void LuaScript::pushFunction(char *func) {
+ if (!_systemInit)
+ return;
+
+ lua_getglobal(_state, func);
+ warning("STUB: pushFunction: Open Dialog if Cheating_On");
+}
+
+void LuaScript::call(int args, int returns) {
+ if (!_systemInit)
+ return;
+
+ lua_call(_state, args, returns);
+}
+
bool LuaScript::callFunction(const char *name, int returns) {
if (!_systemInit) {
return false;
diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h
index 32eb419996..a67695c576 100644
--- a/engines/hdb/lua-script.h
+++ b/engines/hdb/lua-script.h
@@ -44,7 +44,13 @@ public:
bool init();
bool initScript(Common::SeekableReadStream *stream, const char *scriptName, int32 length);
+
+ void pushInt(int value);
+ void pushString(char *string);
+ void pushFunction(char *func);
+ void call(int args, int returns);
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(const char *func, int params);