aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-06 05:06:54 +0530
committerEugene Sandulenko2019-09-03 17:16:43 +0200
commitff6baf30b1cee2b6147a6197716942b1dfcb115e (patch)
treeb9643f65065c5bf1347cc2124df5a18805a8d279
parent03a6cbc8f9d1bf4c81fa21be79503ca2761d81cc (diff)
downloadscummvm-rg350-ff6baf30b1cee2b6147a6197716942b1dfcb115e.tar.gz
scummvm-rg350-ff6baf30b1cee2b6147a6197716942b1dfcb115e.tar.bz2
scummvm-rg350-ff6baf30b1cee2b6147a6197716942b1dfcb115e.zip
HDB: Add executeFile to LuaScript
It executes additional files in the current Lua environment
-rw-r--r--engines/hdb/lua-script.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index bf1938873c..1580552151 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -717,7 +717,6 @@ bool LuaScript::executeMPC(Common::SeekableReadStream *stream, const char *name,
return true;
}
-#if 0
bool LuaScript::executeFile(const Common::String &filename) {
if (!_systemInit) {
@@ -731,9 +730,11 @@ bool LuaScript::executeFile(const Common::String &filename) {
}
uint fileSize = file->size();
- const char *fileData = new char[fileSize];
+ char *fileData = new char[fileSize];
file->read((void *)fileData, fileSize);
+ sanitizeScript(fileData);
+
if (!executeChunk(fileData, fileSize, filename)) {
delete[] fileData;
delete file;
@@ -746,7 +747,6 @@ bool LuaScript::executeFile(const Common::String &filename) {
return true;
}
-#endif
bool LuaScript::executeChunk(const char *chunk, uint chunkSize, const Common::String &chunkName) const {