aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-07-09 02:11:51 +0530
committerEugene Sandulenko2019-09-03 17:17:15 +0200
commit6e60d6a287e3bea956cc607f2f2ebfc5b3d11829 (patch)
treeaf8b0e5d52e032b437a01980d2dd8a6d05049e48
parent2315a05ad39e013b009e98baafcbd9b7edb717a1 (diff)
downloadscummvm-rg350-6e60d6a287e3bea956cc607f2f2ebfc5b3d11829.tar.gz
scummvm-rg350-6e60d6a287e3bea956cc607f2f2ebfc5b3d11829.tar.bz2
scummvm-rg350-6e60d6a287e3bea956cc607f2f2ebfc5b3d11829.zip
HDB: Unstub saveGlobal, loadGlobal, purgeGlobals
-rw-r--r--engines/hdb/lua-script.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index 8ce614cabb..bef9c05c0f 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -1086,17 +1086,40 @@ static int startMap(lua_State *L) {
}
static int saveGlobal(lua_State *L) {
- warning("STUB: SAVE GLOBAL");
+ const char *global = lua_tostring(L, 1);
+ int type;
+
+ g_hdb->_lua->checkParameters("saveGlobal", 1);
+
+ lua_pop(L, 1);
+
+ lua_getglobal(L, global);
+ type = lua_type(L, 1);
+ if (type == LUA_TNUMBER) {
+ double value = lua_tonumber(L, 1);
+ g_hdb->_lua->saveGlobalNumber(global, value);
+ } else if (type == LUA_TSTRING) {
+ const char *string = lua_tostring(L, 1);
+ g_hdb->_lua->saveGlobalString(global, string);
+ }
+
return 0;
}
static int loadGlobal(lua_State *L) {
- warning("STUB: LOAD GLOBAL");
+ const char *global = lua_tostring(L, 1);
+
+ g_hdb->_lua->checkParameters("loadGlobal", 1);
+
+ lua_pop(L, 1);
+
+ g_hdb->_lua->loadGlobal(global);
+
return 0;
}
static int purgeGlobals(lua_State *L) {
- warning("STUB: PURGE GLOBALS");
+ g_hdb->_lua->purgeGlobals();
return 0;
}