aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/util/lua/lauxlib.cpp6
-rw-r--r--engines/sword25/util/lua/liolib.cpp15
2 files changed, 19 insertions, 2 deletions
diff --git a/engines/sword25/util/lua/lauxlib.cpp b/engines/sword25/util/lua/lauxlib.cpp
index 526b1c84ab..ce61827e0f 100644
--- a/engines/sword25/util/lua/lauxlib.cpp
+++ b/engines/sword25/util/lua/lauxlib.cpp
@@ -540,7 +540,11 @@ static const char *getF (lua_State *L, void *ud, size_t *size) {
static int errfile (lua_State *L, const char *what, int fnameindex) {
- return luaL_error(L, "LUA function errfile has been removed in ScummVM");
+ const char *serr = "General error";
+ const char *filename = lua_tostring(L, fnameindex) + 1;
+ lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
+ lua_remove(L, fnameindex);
+ return LUA_ERRFILE;
}
diff --git a/engines/sword25/util/lua/liolib.cpp b/engines/sword25/util/lua/liolib.cpp
index f9bad30aed..aea6c328d8 100644
--- a/engines/sword25/util/lua/liolib.cpp
+++ b/engines/sword25/util/lua/liolib.cpp
@@ -27,7 +27,20 @@ static const char *const fnames[] = {"input", "output"};
static int pushresult (lua_State *L, int i, const char *filename) {
- return luaL_error(L, "LUA file I/O functions have been removed in ScummVM");
+ int en = 0; /*errno;*/ // Currently hardcoded for ScumMVM, this may need to be changed
+ if (i) {
+ lua_pushboolean(L, 1);
+ return 1;
+ }
+ else {
+ lua_pushnil(L);
+ if (filename)
+ lua_pushfstring(L, "%s: %s", filename, "General error" /*strerror(en)*/);
+ else
+ lua_pushfstring(L, "%s", "General error" /*strerror(en)*/);
+ lua_pushinteger(L, en);
+ return 3;
+ }
}